mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-03 15:54:18 +00:00
feat(mail): Deletion of mail older than x
This commit is contained in:
@@ -514,3 +514,6 @@
|
||||
|
||||
/* Hotkey to forward to a message */
|
||||
"hotkey_forward" = "f";
|
||||
|
||||
/* Email deletion */
|
||||
"Removal of old emails..." = "Removal of old emails...";
|
||||
@@ -514,3 +514,6 @@
|
||||
|
||||
/* Hotkey to forward to a message */
|
||||
"hotkey_forward" = "f";
|
||||
|
||||
/* Email deletion */
|
||||
"Removal of old emails..." = "Suppression des anciens emails...";
|
||||
@@ -46,6 +46,8 @@
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserSettings.h>
|
||||
|
||||
#import <EOControl/EOQualifier.h>
|
||||
|
||||
#import "UIxMailFolderActions.h"
|
||||
|
||||
@implementation UIxMailFolderActions
|
||||
@@ -1298,4 +1300,20 @@
|
||||
return [self _markMessagesAsJunkOrNotJunk: NO];
|
||||
}
|
||||
|
||||
- (WOResponse *) cleanMailboxAction
|
||||
{
|
||||
NSString *searchString;
|
||||
EOQualifier *searchQualifier;
|
||||
|
||||
searchString = [NSString stringWithFormat: @"(date >= (NSCalendarDate)\"%@\")", @"2020-01-12"];
|
||||
searchQualifier = [EOQualifier qualifierWithQualifierFormat: searchString];
|
||||
|
||||
id foo;
|
||||
foo = [[self clientObject] fetchUIDsMatchingQualifier: searchQualifier
|
||||
sortOrdering: @"date"
|
||||
threaded: NO];
|
||||
|
||||
return [self responseWithStatus: 200];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -49,6 +49,11 @@
|
||||
actionClass = "UIxMailFolderActions";
|
||||
actionName = "expunge";
|
||||
};
|
||||
cleanMailbox = {
|
||||
protectedBy = "View";
|
||||
actionClass = "UIxMailFolderActions";
|
||||
actionName = "cleanMailbox";
|
||||
};
|
||||
createFolder = {
|
||||
protectedBy = "View";
|
||||
actionClass = "UIxMailFolderActions";
|
||||
|
||||
@@ -632,4 +632,63 @@
|
||||
</md-dialog-actions>
|
||||
</md-dialog>
|
||||
</script>
|
||||
<!-- Remove old emails -->
|
||||
<script type="text/ng-template" id="removeOldEmails">
|
||||
<md-dialog flex="50" flex-sm="80" flex-xs="100">
|
||||
<!-- Toolbar -->
|
||||
<md-toolbar>
|
||||
<div class="md-toolbar-tools">
|
||||
<div class="md-title">Manage Folders</div>
|
||||
<md-button class="md-icon-button" ng-click="dialogCtrl.closeDialog()">
|
||||
<md-icon aria-label="Close dialog">close</md-icon>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
|
||||
<!-- Dialog Content -->
|
||||
<md-dialog-content class="md-dialog-content">
|
||||
<div class="md-dialog-content">
|
||||
<!-- Folder Name Input -->
|
||||
<md-input-container class="md-block">
|
||||
<label>Folder</label>
|
||||
<input type="text" class="sg-readonly" ng-model="dialogCtrl.folderName" readonly="true" />
|
||||
</md-input-container>
|
||||
|
||||
<!-- Checkboxes -->
|
||||
<md-input-container class="md-block">
|
||||
<md-checkbox ng-model="dialogCtrl.form.moveToTrash" aria-label="Move emails to trash">
|
||||
Move emails to trash
|
||||
</md-checkbox>
|
||||
</md-input-container>
|
||||
|
||||
<md-input-container class="md-block">
|
||||
<md-checkbox ng-model="dialogCtrl.form.applyToSubfolders" aria-label="Apply to subfolders">
|
||||
Apply to subfolders
|
||||
</md-checkbox>
|
||||
</md-input-container>
|
||||
|
||||
<!-- Dropdown List -->
|
||||
<md-input-container class="md-block">
|
||||
<label>Filter Emails</label>
|
||||
<md-select ng-model="dialogCtrl.form.filterDuration">
|
||||
<md-option value="3m">≥ 3 months</md-option>
|
||||
<md-option value="6m">≥ 6 months</md-option>
|
||||
<md-option value="9m">≥ 9 months</md-option>
|
||||
<md-option value="1y">≥ 1 year</md-option>
|
||||
</md-select>
|
||||
</md-input-container>
|
||||
</div>
|
||||
</md-dialog-content>
|
||||
|
||||
<!-- Dialog Actions -->
|
||||
<md-dialog-actions>
|
||||
<md-button class="md-warn" ng-click="dialogCtrl.closeDialog()">
|
||||
Cancel
|
||||
</md-button>
|
||||
<md-button class="md-primary" ng-click="dialogCtrl.apply()">
|
||||
Apply
|
||||
</md-button>
|
||||
</md-dialog-actions>
|
||||
</md-dialog>
|
||||
</script>
|
||||
</container>
|
||||
|
||||
@@ -179,6 +179,11 @@
|
||||
<var:string label:value="Compact"/>
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
<md-menu-item>
|
||||
<md-button type="button" ng-click="$menuCtrl.removeOldEmails()">
|
||||
<var:string label:value="Removal of old emails ..."/>
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
<md-menu-item ng-show="::$menuCtrl.folder.$isEditable">
|
||||
<md-button type="button" ng-click="$menuCtrl.confirmDelete()">
|
||||
<var:string label:value="Delete"/>
|
||||
|
||||
@@ -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'));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user