Allow a mailbox to be deleted immediately

Fixes #3875
This commit is contained in:
Francis Lachapelle
2016-11-01 11:40:59 -04:00
parent 5c7147cccc
commit 0e0f53cd98
6 changed files with 116 additions and 60 deletions
@@ -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));
});
});
});
});
}