mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-06 07:36:24 +00:00
(js) Simplify Account.prototype.$newMailbox
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user