cannot disable sendmail if not optional

This commit is contained in:
Girish Ramakrishnan
2021-10-01 11:19:26 -07:00
parent 54668c92ba
commit 54731392ff

View File

@@ -1484,7 +1484,9 @@ async function setMailbox(app, data, auditSource) {
let error = checkAppState(app, exports.ISTATE_PENDING_RECREATE_CONTAINER);
if (error) throw error;
if (!app.manifest.addons?.sendmail) throw new BoxError(BoxError.BAD_FIELD, 'App does not use mail addons');
if (!app.manifest.addons?.sendmail) throw new BoxError(BoxError.BAD_FIELD, 'App does not use sendmail');
const optional = 'optional' in app.manifest.addons.sendmail ? app.manifest.addons.sendmail.optional : false;
if (!optional && !enable) throw new BoxError(BoxError.BAD_FIELD, 'App requires sendmail to be enabled');
await mail.getDomain(mailboxDomain); // check if domain exists