Do not error if mailbox state is already correct
This commit is contained in:
+1
-1
@@ -687,7 +687,7 @@ function disableUserMailbox(domain, userId, callback) {
|
||||
if (error) return callback(new MailError(MailError.INTERNAL_ERROR, error));
|
||||
|
||||
mailboxdb.del(result.username, domain, function (error) {
|
||||
if (error && error.reason === UserError.NOT_FOUND) return callback(new MailError(MailError.NOT_FOUND, 'no such mailbox'));
|
||||
if (error && error.reason === DatabaseError.NOT_FOUND) return callback(new MailError(MailError.NOT_FOUND, 'no such mailbox'));
|
||||
if (error) return callback(new MailError(MailError.INTERNAL_ERROR, error));
|
||||
|
||||
callback(null);
|
||||
|
||||
+2
-1
@@ -157,6 +157,7 @@ function enableUserMailbox(req, res, next) {
|
||||
|
||||
mail.enableUserMailbox(req.params.domain, req.params.userId, function (error) {
|
||||
if (error && error.reason === MailError.NOT_FOUND) return next(new HttpError(404, error.message));
|
||||
if (error && error.reason === MailError.ALREADY_EXISTS) return next(new HttpSuccess(201, {}));
|
||||
if (error) return next(new HttpError(500, error));
|
||||
|
||||
next(new HttpSuccess(201, {}));
|
||||
@@ -168,7 +169,7 @@ function disableUserMailbox(req, res, next) {
|
||||
assert.strictEqual(typeof req.params.userId, 'string');
|
||||
|
||||
mail.disableUserMailbox(req.params.domain, req.params.userId, function (error) {
|
||||
if (error && error.reason === MailError.NOT_FOUND) return next(new HttpError(404, error.message));
|
||||
if (error && error.reason === MailError.NOT_FOUND) return next(new HttpSuccess(201, {}));
|
||||
if (error) return next(new HttpError(500, error));
|
||||
|
||||
next(new HttpSuccess(201, {}));
|
||||
|
||||
Reference in New Issue
Block a user