Skip to content

Commit

Permalink
(js) Simplify Mailbox.prototype.$emptyTrash
Browse files Browse the repository at this point in the history
  • Loading branch information
cgx committed Aug 20, 2015
1 parent e5b0596 commit 83fee27
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions UI/WebServerResources/js/Mailer/Mailbox.service.js
Expand Up @@ -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 = {};
Expand All @@ -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;
};

/**
Expand Down

0 comments on commit 83fee27

Please sign in to comment.