diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index d1451319c1..45b54ceaa5 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -400,7 +400,7 @@ class mail_ui //or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type) 'actions' => self::get_actions(), 'row_id' => 'row_id', // is a concatenation of trim($GLOBALS['egw_info']['user']['account_id']):profileID:base64_encode(FOLDERNAME):uid - 'placeholder_actions' => array('composeasnew') + 'placeholder_actions' => array('composeasnew'), ); } } @@ -451,6 +451,7 @@ class mail_ui //$zendtime = microtime(true) - $zstarttime; //error_log(__METHOD__.__LINE__. " time used: ".$zendtime); $content[self::$nm_index]['selectedFolder'] = $this->mail_bo->profileID.self::$delimiter.(!empty($this->mail_bo->sessionData['mailbox'])?$this->mail_bo->sessionData['mailbox']:'INBOX'); + error_log(__METHOD__."() setting nm[selectedFolder]={$content[self::$nm_index]['selectedFolder']}"); // since we are connected,(and selected the folder) we check for capabilities SUPPORTS_KEYWORDS to eventually add the keyword filters if ( $this->mail_bo->icServer->hasCapability('SUPPORTS_KEYWORDS')) { diff --git a/mail/js/app.js b/mail/js/app.js index 28ba8343aa..b22ecc0cb4 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -284,36 +284,21 @@ app.classes.mail = AppJS.extend( * We only cache the first chunk (50 rows), and only if search filter is not set, * but we cache this for every combination of folder, filter & filter2. * + * We do not cache, if we dont find selectedFolder in query_context, + * as looking it up in tree causes mails to be cached for wrong folder + * (Probably because user already clicked on an other folder)! + * * @param {object} query_context Query information from egw.dataFetch() * @returns {string|false} Cache key, or false to not cache */ nm_cache: function(query_context) { // Only cache first chunk of rows, if no search filter - if((!query_context || !query_context.start) && query_context.count == 0 && !( - !query_context.self._filters || query_context.self._filters.search || false) + if((!query_context || !query_context.start) && query_context.count == 0 && + query_context.self._filters.selectedFolder && + !(!query_context.self._filters || query_context.self._filters.search) ) { - // Tree is not a child of nextmatch, so we need to - // set nextmatch filter 'selectedFolder' to initial value, but in that - // case, the normal structure is not fully set up yet. - if(!query_context.self._filters.selectedFolder && query_context.self._widget) - { - var tree = query_context.self._widget; - while(tree.getParent() != null) - { - // find root - tree = tree.getParent(); - } - if(tree) - { - tree = tree.getWidgetById('nm[foldertree]'); - } - if(tree) - { - query_context.self._filters.selectedFolder = tree.getValue(); - } - } // Make sure keys match, even if some filters are not defined return JSON.stringify({ selectedFolder: query_context.self._filters.selectedFolder || '',