(js) Fix (sub)mailboxes state restore
parent
35d1ca8775
commit
790fc8e940
|
@ -108,7 +108,15 @@
|
||||||
|
|
||||||
// Set expanded folders from user's settings
|
// Set expanded folders from user's settings
|
||||||
Account.$Preferences.ready().then(function() {
|
Account.$Preferences.ready().then(function() {
|
||||||
var expandedFolders;
|
var expandedFolders,
|
||||||
|
_visit = function(mailboxes) {
|
||||||
|
_.forEach(mailboxes, function(o) {
|
||||||
|
o.$expanded = (expandedFolders.indexOf('/' + o.id) >= 0);
|
||||||
|
if (o.children && o.children.length > 0) {
|
||||||
|
_visit(o.children);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
if (Account.$Preferences.settings.Mail.ExpandedFolders) {
|
if (Account.$Preferences.settings.Mail.ExpandedFolders) {
|
||||||
if (angular.isString(Account.$Preferences.settings.Mail.ExpandedFolders))
|
if (angular.isString(Account.$Preferences.settings.Mail.ExpandedFolders))
|
||||||
// Backward compatibility support
|
// Backward compatibility support
|
||||||
|
@ -116,9 +124,7 @@
|
||||||
else
|
else
|
||||||
expandedFolders = Account.$Preferences.settings.Mail.ExpandedFolders;
|
expandedFolders = Account.$Preferences.settings.Mail.ExpandedFolders;
|
||||||
if (expandedFolders.length > 0) {
|
if (expandedFolders.length > 0) {
|
||||||
_.forEach(_this.$mailboxes, function(mailbox) {
|
_visit(_this.$mailboxes);
|
||||||
mailbox.$expanded = (expandedFolders.indexOf('/' + mailbox.id) >= 0);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_this.$flattenMailboxes({reload: true});
|
_this.$flattenMailboxes({reload: true});
|
||||||
|
|
Loading…
Reference in New Issue