Skip to content

Commit

Permalink
(js) Simplify Account.prototype.$newMailbox
Browse files Browse the repository at this point in the history
  • Loading branch information
cgx committed Aug 20, 2015
1 parent 83fee27 commit 1470258
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions UI/WebServerResources/js/Mailer/Account.service.js
Expand Up @@ -186,18 +186,11 @@
* @returns a promise of the HTTP operations
*/
Account.prototype.$newMailbox = function(path, name) {
var _this = this,
deferred = Account.$q.defer();
var _this = this;

// Prefix '' to the path since we might get an integer here (account's id)
Account.$$resource.post('' + path, 'createFolder', {name: name}).then(function() {
return Account.$$resource.post(path.toString(), 'createFolder', {name: name}).then(function() {
_this.$getMailboxes({reload: true});
deferred.resolve();
}, function(response) {
deferred.reject(response.error);
});

return deferred.promise;
};

/**
Expand Down

0 comments on commit 1470258

Please sign in to comment.