mail: restart apps using email addon
move this logic from frontend to backend
This commit is contained in:
@@ -114,6 +114,9 @@ async function setMailEnabled(req, res, next) {
|
||||
|
||||
if (typeof req.body.enabled !== 'boolean') return next(new HttpError(400, 'enabled is required'));
|
||||
|
||||
// can take a while to restart the mail container
|
||||
req.clearTimeout();
|
||||
|
||||
const [error] = await safe(mail.setMailEnabled(req.params.domain, !!req.body.enabled, AuditSource.fromRequest(req)));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
@@ -237,7 +240,7 @@ async function setAliases(req, res, next) {
|
||||
|
||||
if (!Array.isArray(req.body.aliases)) return next(new HttpError(400, 'aliases must be an array'));
|
||||
|
||||
for (let alias of req.body.aliases) {
|
||||
for (const alias of req.body.aliases) {
|
||||
if (!alias || typeof alias !== 'object') return next(new HttpError(400, 'each alias must have a name and domain'));
|
||||
if (typeof alias.name !== 'string') return next(new HttpError(400, 'name must be a string'));
|
||||
if (typeof alias.domain !== 'string') return next(new HttpError(400, 'domain must be a string'));
|
||||
|
||||
Reference in New Issue
Block a user