Cleanup .bind(

This commit is contained in:
djmaze 2021-04-23 10:47:24 +02:00
parent 9ec84baa32
commit 29fe73d4e7
7 changed files with 143 additions and 246 deletions

View file

@ -187,7 +187,48 @@ class DomainPopupView extends AbstractViewPopup {
this.testing(true);
Remote.testConnectionForDomain(
this.onTestConnectionResponse.bind(this),
(iError, oData) => {
this.testing(false);
if (iError) {
this.testingImapError(true);
this.testingSieveError(true);
this.testingSmtpError(true);
this.sieveSettings(false);
} else {
let bImap = false,
bSieve = false;
this.testingDone(true);
this.testingImapError(true !== oData.Result.Imap);
this.testingSieveError(true !== oData.Result.Sieve);
this.testingSmtpError(true !== oData.Result.Smtp);
if (this.testingImapError() && oData.Result.Imap) {
bImap = true;
this.testingImapErrorDesc('');
this.testingImapErrorDesc(oData.Result.Imap);
}
if (this.testingSieveError() && oData.Result.Sieve) {
bSieve = true;
this.testingSieveErrorDesc('');
this.testingSieveErrorDesc(oData.Result.Sieve);
}
if (this.testingSmtpError() && oData.Result.Smtp) {
this.testingSmtpErrorDesc('');
this.testingSmtpErrorDesc(oData.Result.Smtp);
}
if (this.sieveSettings()) {
if (!bSieve && bImap) {
this.sieveSettings(false);
}
} else if (bSieve && !bImap) {
this.sieveSettings(true);
}
}
},
this
);
}
@ -205,49 +246,6 @@ class DomainPopupView extends AbstractViewPopup {
this.clearTesting();
}
onTestConnectionResponse(iError, oData) {
this.testing(false);
if (iError) {
this.testingImapError(true);
this.testingSieveError(true);
this.testingSmtpError(true);
this.sieveSettings(false);
} else {
let bImap = false,
bSieve = false;
this.testingDone(true);
this.testingImapError(true !== oData.Result.Imap);
this.testingSieveError(true !== oData.Result.Sieve);
this.testingSmtpError(true !== oData.Result.Smtp);
if (this.testingImapError() && oData.Result.Imap) {
bImap = true;
this.testingImapErrorDesc('');
this.testingImapErrorDesc(oData.Result.Imap);
}
if (this.testingSieveError() && oData.Result.Sieve) {
bSieve = true;
this.testingSieveErrorDesc('');
this.testingSieveErrorDesc(oData.Result.Sieve);
}
if (this.testingSmtpError() && oData.Result.Smtp) {
this.testingSmtpErrorDesc('');
this.testingSmtpErrorDesc(oData.Result.Smtp);
}
if (this.sieveSettings()) {
if (!bSieve && bImap) {
this.sieveSettings(false);
}
} else if (bSieve && !bImap) {
this.sieveSettings(true);
}
}
}
onDomainCreateOrSaveResponse(iError) {
this.saving(false);
if (iError) {