From a28cbb4d7eedf362650e18a7da14d3eee60323b3 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 6 Aug 2014 21:13:27 +0000 Subject: [PATCH] - Fix cache key to include sorting - Fix cache key for initial load, was missing selected folder - Avoid deleting data, it causes blank rows. Refreshing instead. --- mail/js/app.js | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index 16ae91036e..db5f4585fc 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -76,6 +76,7 @@ app.classes.mail = AppJS.extend( // TODO: Change this as needed function(server_query) { + // Unlock tree if using a cache, since the server won't if(!server_query) this.unlock_tree(); }, this @@ -290,11 +291,32 @@ app.classes.mail = AppJS.extend( !query_context.self._filters || query_context.self._filters.search || false) ) { + // 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 || '', filter: query_context.self._filters.filter || '', - filter2: query_context.self._filters.filter2 + filter2: query_context.self._filters.filter2 || '', + sort: query_context.self._filters.sort }); } return false; @@ -322,10 +344,9 @@ app.classes.mail = AppJS.extend( { if (_reset == true) { - //var nm = this.et2.getWidgetById(nm_index); - //if (this.mail_currentlyFocussed!='') nm.refresh([this.mail_currentlyFocussed],'delete');//egw.dataDeleteUID(this.mail_currentlyFocussed); - if (this.mail_currentlyFocussed!='') egw.dataDeleteUID(this.mail_currentlyFocussed); - for(var k = 0; k < this.mail_selectedMails.length; k++) egw.dataDeleteUID(this.mail_selectedMails[k]); + // Request updated data, if possible + if (this.mail_currentlyFocussed!='') egw.dataRefreshUID(this.mail_currentlyFocussed); + for(var k = 0; k < this.mail_selectedMails.length; k++) egw.dataRefreshUID(this.mail_selectedMails[k]); //nm.refresh(this.mail_selectedMails,'delete'); } this.mail_selectedMails = []; @@ -1620,7 +1641,6 @@ app.classes.mail = AppJS.extend( // Update non-grid this.mail_refreshFolderStatus(_folder,'forced',false,false); this.mail_refreshQuotaDisplay(server[0]); - this.mail_fetchCurrentlyFocussed(null,true); this.mail_preview(); if (server[0]!=previousServer[0]) {