feat(mail): Deletion of mail older than x

This commit is contained in:
smizrahi
2024-11-16 09:49:55 +01:00
parent cd0324dd49
commit bce575a53d
9 changed files with 146 additions and 0 deletions
@@ -1312,4 +1312,10 @@
Mailbox.prototype.getHighlightWords = function () {
return this.$highlightWords;
};
/* TODO */
Mailbox.prototype.cleanMailbox = function () {
Mailbox.$$resource.post(this.id, 'cleanMailbox');
};
})();
@@ -53,6 +53,10 @@
$rootScope.$on('resetMailAdvancedSearchPanel', function () {
vm.reset();
});
$rootScope.$on('showRemoveOldEmailsPanel', function (e, d) {
vm.showRemoveOldEmailsPanel(d.folder);
});
};
@@ -447,6 +451,41 @@
});
};
this.showRemoveOldEmailsPanel = function (folder) {
// Close sidenav on small devices
if (!$mdMedia(sgConstant['gt-md']))
$mdSidenav('left').close();
$mdDialog.show({
template: document.getElementById('removeOldEmails').innerHTML,
parent: angular.element(document.body),
controller: function () {
var dialogCtrl = this;
this.$onInit = function () {
// Pass main controller
this.mainController = vm;
this.folder = folder;
this.folderName = folder.$displayName;
};
dialogCtrl.closeDialog = function () {
$mdDialog.hide();
};
dialogCtrl.apply = function () {
console.log(this.mailbox);
this.folder.cleanMailbox();
// $mdDialog.hide();
};
},
controllerAs: 'dialogCtrl',
clickOutsideToClose: false,
escapeToClose: false,
});
};
this.delegate = function(account) {
$mdDialog.show({
templateUrl: account.id + '/delegation', // UI/Templates/MailerUI/UIxMailUserDelegation.wox
@@ -271,6 +271,14 @@
});
};
this.removeOldEmails = function () {
// Close sidenav on small devices
if (!$mdMedia(sgConstant['gt-md']))
$mdSidenav('left').close();
$rootScope.$broadcast('showRemoveOldEmailsPanel', {folder: this.folder}); // Show remove old emails panel (broadcast event to MailboxesController)
};
this.emptyJunkFolder = function() {
return this.emptyFolder(l('Junk folder emptied'));
};