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

This commit is contained in:
Ralf Becker 2014-08-20 16:12:19 +00:00
parent 7da0a6d6c6
commit 6b243800c4
2 changed files with 9 additions and 23 deletions

View File

@ -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) //or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type)
'actions' => self::get_actions(), 'actions' => self::get_actions(),
'row_id' => 'row_id', // is a concatenation of trim($GLOBALS['egw_info']['user']['account_id']):profileID:base64_encode(FOLDERNAME):uid '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; //$zendtime = microtime(true) - $zstarttime;
//error_log(__METHOD__.__LINE__. " time used: ".$zendtime); //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'); $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 // 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')) if ( $this->mail_bo->icServer->hasCapability('SUPPORTS_KEYWORDS'))
{ {

View File

@ -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, * 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. * 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() * @param {object} query_context Query information from egw.dataFetch()
* @returns {string|false} Cache key, or false to not cache * @returns {string|false} Cache key, or false to not cache
*/ */
nm_cache: function(query_context) nm_cache: function(query_context)
{ {
// Only cache first chunk of rows, if no search filter // Only cache first chunk of rows, if no search filter
if((!query_context || !query_context.start) && query_context.count == 0 && !( if((!query_context || !query_context.start) && query_context.count == 0 &&
!query_context.self._filters || query_context.self._filters.search || false) 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 // Make sure keys match, even if some filters are not defined
return JSON.stringify({ return JSON.stringify({
selectedFolder: query_context.self._filters.selectedFolder || '', selectedFolder: query_context.self._filters.selectedFolder || '',