diff --git a/UI/WebServerResources/js/Mailer/Mailbox.service.js b/UI/WebServerResources/js/Mailer/Mailbox.service.js index 128a277461..fab6ca16b8 100644 --- a/UI/WebServerResources/js/Mailer/Mailbox.service.js +++ b/UI/WebServerResources/js/Mailer/Mailbox.service.js @@ -413,13 +413,9 @@ * @returns a promise of the HTTP operation */ Mailbox.prototype.$emptyTrash = function() { - var _this = this, - deferred = Mailbox.$q.defer(), - promise; - - promise = Mailbox.$$resource.post(this.id, 'emptyTrash'); + var _this = this; - promise.then(function() { + return Mailbox.$$resource.post(this.id, 'emptyTrash').then(function() { // Remove all messages from the mailbox _this.$messages = []; _this.uidsMap = {}; @@ -428,11 +424,7 @@ // If we had any submailboxes, lets do a refresh of the mailboxes list if (angular.isDefined(_this.children) && _this.children.length) _this.$account.$getMailboxes({reload: true}); - }, function(data, status) { - deferred.reject(data); }); - - return deferred.promise; }; /**