Add option to remove mailbox data

Fixes #720
This commit is contained in:
Girish Ramakrishnan
2020-07-27 22:26:10 -07:00
parent 3c59a0ff31
commit ed09c06ba4
7 changed files with 51 additions and 7 deletions

View File

@@ -221,7 +221,9 @@ function removeMailbox(req, res, next) {
assert.strictEqual(typeof req.params.domain, 'string');
assert.strictEqual(typeof req.params.name, 'string');
mail.removeMailbox(req.params.name, req.params.domain, auditSource.fromRequest(req), function (error) {
if (typeof req.body.deleteMails !== 'boolean') return next(new HttpError(400, 'deleteMails must be a boolean'));
mail.removeMailbox(req.params.name, req.params.domain, req.body, auditSource.fromRequest(req), function (error) {
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(201, {}));