Do not error if mailbox state is already correct

This commit is contained in:
Johannes Zellner
2018-01-24 15:40:32 +01:00
parent c7282e861c
commit 962ebc835d
2 changed files with 3 additions and 2 deletions

View File

@@ -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, {}));