(js) Restore immediate deletion of messages

pull/225/head
Francis Lachapelle 2016-11-01 10:35:00 -04:00
parent 67f566ec9d
commit 5c7147cccc
4 changed files with 28 additions and 6 deletions

1
NEWS
View File

@ -22,6 +22,7 @@ Bug fixes
- [web] fixed auto-completion of list members (#3870)
- [web] added missing options to subscribed addressbooks (#3850)
- [web] fixed resource conflict error handling (403 vs 409 HTTP code)
- [web] restored immediate deletion of messages (without moving them to the trash)
- [eas] improve handling of email folders without a parent
- [eas] never send IMIP reply when the "initiator" is Outlook 2013/2016
- [core] only consider SMTP addresses for AD's proxyAddresses (#3842)

View File

@ -164,7 +164,7 @@
<md-tooltip md-direction="bottom"><var:string label:value="Select All"/></md-tooltip>
<md-icon>select_all</md-icon>
</md-button>
<md-button class="sg-icon-button" ng-click="mailbox.confirmDeleteSelectedMessages()">
<md-button class="sg-icon-button" ng-click="mailbox.confirmDeleteSelectedMessages($event)">
<md-icon>delete</md-icon>
</md-button>
<md-button class="sg-icon-button" ng-click="mailbox.markOrUnMarkMessagesAsJunk()">

View File

@ -676,11 +676,14 @@
* @desc Delete multiple messages from mailbox.
* @return a promise of the HTTP operation
*/
Mailbox.prototype.$deleteMessages = function(messages) {
var _this = this, uids;
Mailbox.prototype.$deleteMessages = function(messages, options) {
var _this = this, uids, data;
uids = _.map(messages, 'uid');
return Mailbox.$$resource.post(this.id, 'batchDelete', {uids: uids})
data = { uids: uids };
if (options) angular.extend(data, options);
return Mailbox.$$resource.post(this.id, 'batchDelete', data)
.then(function(data) {
// Update inbox quota
if (data.quotas)

View File

@ -268,9 +268,9 @@
return [vm.selectedFolder];
}
// Unselect current message and cleverly load the next message.
// This function must not be called in virtual mode.
function _unselectMessage(message, index) {
// Unselect current message and cleverly load the next message.
// This function must not be called in virtual mode.
var nextMessage, previousMessage, nextIndex = index;
vm.mode.multiple = vm.selectedFolder.$selectedCount();
if (message) {
@ -327,6 +327,24 @@
// In normal mode, we immediately unselect the selected message.
_unselectMessage(deleteSelectedMessage, index);
}
}, function(response) {
messageDialog = Dialog.confirm(l('Warning'),
l('The messages could not be moved to the trash folder. Would you like to delete them immediately?'),
{ ok: l('Delete') })
.then(function() {
vm.selectedFolder.$deleteMessages(selectedMessages, { withoutTrash: true }).then(function(index) {
if (Mailbox.$virtualMode) {
// When performing an advanced search, we refresh the view if the selected message
// was deleted, but only once all promises have completed.
if (deleteSelectedMessage)
$state.go('mail.account.virtualMailbox');
}
else {
// In normal mode, we immediately unselect the selected message.
_unselectMessage(deleteSelectedMessage, index);
}
});
});
});
})
.finally(function() {