mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-07 09:25:09 +00:00
Expunge mailbox on specific actions
Current mailbox is now expunged when leaving the Mail module. The drafts mailbox is also expunged when a message is sent.
This commit is contained in:
@@ -6,11 +6,11 @@
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
MailboxController.$inject = ['$window', '$timeout', '$q', '$state', '$mdDialog', '$mdToast', 'stateAccounts', 'stateAccount', 'stateMailbox', 'encodeUriFilter', 'sgFocus', 'Dialog', 'Account', 'Mailbox'];
|
||||
function MailboxController($window, $timeout, $q, $state, $mdDialog, $mdToast, stateAccounts, stateAccount, stateMailbox, encodeUriFilter, focus, Dialog, Account, Mailbox) {
|
||||
MailboxController.$inject = ['$window', '$scope', '$timeout', '$q', '$state', '$mdDialog', '$mdToast', 'stateAccounts', 'stateAccount', 'stateMailbox', 'encodeUriFilter', 'sgFocus', 'Dialog', 'Account', 'Mailbox'];
|
||||
function MailboxController($window, $scope, $timeout, $q, $state, $mdDialog, $mdToast, stateAccounts, stateAccount, stateMailbox, encodeUriFilter, focus, Dialog, Account, Mailbox) {
|
||||
var vm = this, messageDialog = null;
|
||||
|
||||
// Expose controller
|
||||
// Expose controller for eventual popup windows
|
||||
$window.$mailboxController = vm;
|
||||
|
||||
stateMailbox.selectFolder();
|
||||
@@ -36,6 +36,16 @@
|
||||
vm.selectAll = selectAll;
|
||||
vm.unselectMessages = unselectMessages;
|
||||
|
||||
// Expunge mailbox when leaving the Mail module
|
||||
angular.element($window).on('beforeunload', _compactBeforeUnload);
|
||||
$scope.$on('$destroy', function() {
|
||||
angular.element($window).off('beforeunload', _compactBeforeUnload);
|
||||
});
|
||||
|
||||
function _compactBeforeUnload(event) {
|
||||
return vm.selectedFolder.$compact();
|
||||
}
|
||||
|
||||
function sort(field) {
|
||||
vm.selectedFolder.$filter({ sort: field });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user