fix(mail(js)): force search when restoring mailbox during navigation

This commit is contained in:
Francis Lachapelle
2021-10-14 14:32:16 -04:00
parent fa68c864f1
commit 0eb452c412
3 changed files with 14 additions and 3 deletions
@@ -72,7 +72,7 @@
<md-icon>search</md-icon>
</md-button>
<a href="#" class="sg-folder-name"
ng-click="mailbox.searchMode($event)" ng-bind="mailbox.selectedFolder.$displayName"><!-- mailbox name --></a>
ng-click="mailbox.searchMode($event)" ng-bind="mailbox.service.selectedFolder.$displayName"><!-- mailbox name --></a>
<md-menu>
<md-button class="sg-icon-button" label:aria-label="Sort"
ng-click="$mdMenu.open()">
@@ -868,13 +868,18 @@
* @memberof Mailbox.prototype
* @desc Reset the original state the mailbox's data.
*/
Mailbox.prototype.$reset = function() {
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;
}
};
/**
@@ -53,8 +53,14 @@
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) {
keys.push(sgHotkeys.createHotkey({