mail: fix location change

This commit is contained in:
Girish Ramakrishnan
2021-09-03 11:38:21 -07:00
parent e2cb0daec1
commit 1df0c12d6f

View File

@@ -578,7 +578,7 @@ async function checkConfiguration() {
const allDomains = await listDomains();
for (const domainObject of allDomains) {
const result = await util.promisify(getStatus)(domainObject.domain);
const result = await getStatus(domainObject.domain);
let message = [];
@@ -933,13 +933,11 @@ async function setDnsRecords(domain) {
await upsertDnsRecords(domain, settings.mailFqdn());
}
function getLocation(callback) {
assert.strictEqual(typeof callback, 'function');
async function getLocation() {
const domain = settings.mailDomain(), fqdn = settings.mailFqdn();
const subdomain = fqdn.substr(0, fqdn.length - domain.length - 1);
callback(null, { domain, subdomain });
return { domain, subdomain };
}
async function changeLocation(auditSource, progressCallback) {
@@ -960,7 +958,7 @@ async function changeLocation(auditSource, progressCallback) {
progressCallback({ percent: progress, message: `Updating DNS of ${domainObject.domain}` });
progress += Math.round(70/allDomains.length);
const [error] = await safe(util.promisify(upsertDnsRecords)(domainObject.domain, fqdn)); // ignore any errors. we anyway report dns errors in status tab
const [error] = await safe(upsertDnsRecords(domainObject.domain, fqdn)); // ignore any errors. we anyway report dns errors in status tab
progressCallback({ percent: progress, message: `Updated DNS of ${domainObject.domain}: ${error ? error.message : 'success'}` });
}