mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-14 01:38:51 +00:00
fix(mail(js)): reset mailboxes state when leaving global search
This commit is contained in:
@@ -869,25 +869,6 @@
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $reset
|
||||
* @memberof Mailbox.prototype
|
||||
* @desc Reset the original state the mailbox's data.
|
||||
*/
|
||||
Mailbox.prototype.$reset = function(options) {
|
||||
var _this = this;
|
||||
angular.forEach(this.$shadowData, function(value, key) {
|
||||
delete _this[key];
|
||||
});
|
||||
angular.extend(this, this.$shadowData);
|
||||
this.$shadowData = this.$omit();
|
||||
if (options && options.filter) {
|
||||
this.$messages = [];
|
||||
this.$visibleMessages = [];
|
||||
delete this.$syncToken;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $move
|
||||
* @memberof Mailbox.prototype
|
||||
@@ -935,6 +916,25 @@
|
||||
return this.$account.$newMailbox(path, name);
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $reset
|
||||
* @memberof Mailbox.prototype
|
||||
* @desc Reset the original state the mailbox's data.
|
||||
*/
|
||||
Mailbox.prototype.$reset = function(options) {
|
||||
var _this = this;
|
||||
angular.forEach(this.$shadowData, function(value, key) {
|
||||
delete _this[key];
|
||||
});
|
||||
angular.extend(this, this.$shadowData);
|
||||
this.$shadowData = this.$omit();
|
||||
if (options && options.filter) {
|
||||
this.$messages = [];
|
||||
this.$visibleMessages = [];
|
||||
delete this.$syncToken;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $omit
|
||||
* @memberof Mailbox.prototype
|
||||
|
||||
@@ -42,6 +42,10 @@
|
||||
_.forEach(hotkeys, function(key) {
|
||||
sgHotkeys.deregisterHotkey(key);
|
||||
});
|
||||
if (vm.mode.search) {
|
||||
vm.mode.search = false;
|
||||
vm.selectedFolder.$reset({ filter: true });
|
||||
}
|
||||
});
|
||||
|
||||
// Update window's title with unseen messages count of selected mailbox
|
||||
@@ -53,13 +57,6 @@
|
||||
title += ' | ' + defaultWindowTitle;
|
||||
$window.document.title = title;
|
||||
});
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
if (vm.mode.search) {
|
||||
vm.mode.search = false;
|
||||
vm.selectedFolder.$reset({ filter: true });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function _registerHotkeys(keys) {
|
||||
|
||||
@@ -399,4 +399,15 @@
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $reset
|
||||
* @memberof VirtualMailbox.prototype
|
||||
* @desc Reset the original state all mailboxes data.
|
||||
*/
|
||||
VirtualMailbox.prototype.$reset = function(options) {
|
||||
_.forEach(this.$mailboxes, function(mailbox) {
|
||||
mailbox.$reset(options);
|
||||
});
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -87,7 +87,10 @@
|
||||
if (this.editMode || this.mailbox == Mailbox.selectedFolder || this.mailbox.isNoSelect())
|
||||
return;
|
||||
Mailbox.$virtualPath = false;
|
||||
Mailbox.$virtualMode = false;
|
||||
if (Mailbox.$virtualMode) {
|
||||
Mailbox.$virtualMode = false;
|
||||
Mailbox.selectedFolder.$reset({ filter: true });
|
||||
}
|
||||
this.accountController.selectFolder(this);
|
||||
if ($event) {
|
||||
$state.go('mail.account.mailbox', {
|
||||
|
||||
Reference in New Issue
Block a user