merge userdb.js into users.js
This commit is contained in:
29
src/mail.js
29
src/mail.js
@@ -750,26 +750,20 @@ function restartMail(callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function restartMailIfActivated(callback) {
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
async function restartMailIfActivated() {
|
||||
const activated = await users.isActivated();
|
||||
|
||||
users.isActivated(function (error, activated) {
|
||||
if (error) return callback(error);
|
||||
if (!activated) {
|
||||
debug('restartMailIfActivated: skipping restart of mail container since Cloudron is not activated yet');
|
||||
return; // not provisioned yet, do not restart container after dns setup
|
||||
}
|
||||
|
||||
if (!activated) {
|
||||
debug('restartMailIfActivated: skipping restart of mail container since Cloudron is not activated yet');
|
||||
return callback(); // not provisioned yet, do not restart container after dns setup
|
||||
}
|
||||
|
||||
restartMail(callback);
|
||||
});
|
||||
await util.promisify(restartMail)();
|
||||
}
|
||||
|
||||
function handleCertChanged(callback) {
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
async function handleCertChanged() {
|
||||
debug('handleCertChanged: will restart if activated');
|
||||
restartMailIfActivated(callback);
|
||||
await restartMailIfActivated();
|
||||
}
|
||||
|
||||
async function getDomain(domain) {
|
||||
@@ -998,12 +992,13 @@ function changeLocation(auditSource, progressCallback, callback) {
|
||||
progressCallback({ percent: progress, message: `Updated DNS of ${domainObject.domain}: ${error ? error.message : 'success'}` });
|
||||
iteratorDone();
|
||||
});
|
||||
}, function (error) {
|
||||
}, async function (error) {
|
||||
if (error) return callback(error);
|
||||
|
||||
progressCallback({ percent: 90, message: 'Restarting mail server' });
|
||||
|
||||
restartMailIfActivated(callback);
|
||||
[error] = await safe(restartMailIfActivated());
|
||||
callback(error);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user