(js) Fix restore of mailboxes expansion states
parent
d61a9d0b80
commit
7c4b1b36cf
1
NEWS
1
NEWS
|
@ -14,6 +14,7 @@ Bug fixes
|
||||||
- [web] fixed event classification icon (private/confidential) in day/week/multicolumn views
|
- [web] fixed event classification icon (private/confidential) in day/week/multicolumn views
|
||||||
- [web] fixed display of mailboxes list on mobiles (#3654)
|
- [web] fixed display of mailboxes list on mobiles (#3654)
|
||||||
- [web] restored Catalan and Slovak translations (#3687)
|
- [web] restored Catalan and Slovak translations (#3687)
|
||||||
|
- [web] fixed restore of mailboxes expansion state when multiple IMAP accounts are configured
|
||||||
|
|
||||||
3.1.0 (2016-05-18)
|
3.1.0 (2016-05-18)
|
||||||
------------------
|
------------------
|
||||||
|
|
|
@ -86,6 +86,8 @@
|
||||||
o.id = i;
|
o.id = i;
|
||||||
collection[i] = new Account(o);
|
collection[i] = new Account(o);
|
||||||
});
|
});
|
||||||
|
Account.$accounts = collection;
|
||||||
|
|
||||||
return collection;
|
return collection;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -139,7 +141,10 @@
|
||||||
* @function $flattenMailboxes
|
* @function $flattenMailboxes
|
||||||
* @memberof Account.prototype
|
* @memberof Account.prototype
|
||||||
* @desc Get a flatten array of the mailboxes.
|
* @desc Get a flatten array of the mailboxes.
|
||||||
* @param {object} [options] - force a reload
|
* @param {object} [options] - the following boolean attributes are available:
|
||||||
|
* - reload: rebuild the flatten array of mailboxes from the original tree representation (this.$mailboxes)
|
||||||
|
* - all: return all mailboxes, ignoring their expanstion state
|
||||||
|
* - saveState: save expansion state of mailboxes to the server
|
||||||
* @returns an array of Mailbox instances
|
* @returns an array of Mailbox instances
|
||||||
*/
|
*/
|
||||||
Account.prototype.$flattenMailboxes = function(options) {
|
Account.prototype.$flattenMailboxes = function(options) {
|
||||||
|
@ -163,12 +168,15 @@
|
||||||
if (!options || !options.all) {
|
if (!options || !options.all) {
|
||||||
_this.$$flattenMailboxes = allMailboxes;
|
_this.$$flattenMailboxes = allMailboxes;
|
||||||
if (options && options.saveState) {
|
if (options && options.saveState) {
|
||||||
_.reduce(allMailboxes, function(expandedFolders, mailbox) {
|
// Save expansion state of mailboxes to the server
|
||||||
if (mailbox.$expanded) {
|
_.forEach(Account.$accounts, function(account) {
|
||||||
expandedFolders.push('/' + mailbox.id);
|
_.reduce(account.$$flattenMailboxes, function(expandedFolders, mailbox) {
|
||||||
}
|
if (mailbox.$expanded) {
|
||||||
return expandedFolders;
|
expandedFolders.push('/' + mailbox.id);
|
||||||
}, expandedMailboxes);
|
}
|
||||||
|
return expandedFolders;
|
||||||
|
}, expandedMailboxes);
|
||||||
|
});
|
||||||
Account.$$resource.post(null, 'saveFoldersState', expandedMailboxes);
|
Account.$$resource.post(null, 'saveFoldersState', expandedMailboxes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue