Allow a mailbox to be deleted immediately

Fixes #3875
This commit is contained in:
Francis Lachapelle committed 2016-11-01 11:40:59 -04:00
1 parent 5c7147cccc
commit 0e0f53cd98
6 files changed
+116 -60

No files matched your search

@@ -344,14 +344,26 @@
}
function confirmDelete(folder) {
Dialog.confirm(l('Confirmation'), l('Do you really want to move this folder into the trash ?'))
Dialog.confirm(l('Warning'),
l('Do you really want to move this folder into the trash ?'),
{ ok: l('Delete') })
.then(function() {
folder.$delete()
.then(function() {
$state.go('mail.account.inbox');
}, function(data, status) {
Dialog.alert(l('An error occured while deleting the mailbox "%{0}".', folder.name),
l(data.error));
}, function(response) {
Dialog.confirm(l('Warning'),
l('The mailbox could not be moved to the trash folder. Would you like to delete it immediately?'),
{ ok: l('Delete') })
.then(function() {
folder.$delete({ withoutTrash: true })
.then(function() {
$state.go('mail.account.inbox');
}, function(response) {
Dialog.alert(l('An error occured while deleting the mailbox "%{0}".', folder.name),
l(response.error));
});
});
});
});
}