mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 13:09:21 +03:00
Cleanup more iError && data.Result
This commit is contained in:
parent
87bee226b4
commit
ce74b2e92f
19 changed files with 78 additions and 100 deletions
|
|
@ -605,7 +605,7 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
|
||||
this.saving(false);
|
||||
|
||||
if (!iError && oData && oData.Result) {
|
||||
if (!iError) {
|
||||
if (oData.Result.NewFolder && oData.Result.NewUid) {
|
||||
result = true;
|
||||
|
||||
|
|
@ -1032,7 +1032,7 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
const downloads = this.getAttachmentsDownloadsForUpload();
|
||||
if (isNonEmptyArray(downloads)) {
|
||||
Remote.messageUploadAttachments((iError, oData) => {
|
||||
if (!iError && oData && oData.Result) {
|
||||
if (!iError) {
|
||||
Object.entries(oData.Result).forEach(([tempName, id]) => {
|
||||
const attachment = this.getAttachmentById(id);
|
||||
if (attachment) {
|
||||
|
|
|
|||
|
|
@ -225,8 +225,6 @@ class ContactsPopupView extends AbstractViewPopup {
|
|||
|
||||
if (
|
||||
!iError &&
|
||||
oData &&
|
||||
oData.Result &&
|
||||
oData.Result.RequestUid === requestUid &&
|
||||
0 < pInt(oData.Result.ResultID)
|
||||
) {
|
||||
|
|
@ -457,16 +455,14 @@ class ContactsPopupView extends AbstractViewPopup {
|
|||
let count = 0,
|
||||
list = [];
|
||||
|
||||
if (!iError && data && data.Result && data.Result.List) {
|
||||
if (isNonEmptyArray(data.Result.List)) {
|
||||
data.Result.List.forEach(item => {
|
||||
item = ContactModel.reviveFromJson(item);
|
||||
item && list.push(item);
|
||||
});
|
||||
if (!iError && isNonEmptyArray(data.Result.List)) {
|
||||
data.Result.List.forEach(item => {
|
||||
item = ContactModel.reviveFromJson(item);
|
||||
item && list.push(item);
|
||||
});
|
||||
|
||||
count = pInt(data.Result.Count);
|
||||
count = 0 < count ? count : 0;
|
||||
}
|
||||
count = pInt(data.Result.Count);
|
||||
count = 0 < count ? count : 0;
|
||||
}
|
||||
|
||||
this.contactsCount(count);
|
||||
|
|
|
|||
|
|
@ -206,7 +206,12 @@ class DomainPopupView extends AbstractViewPopup {
|
|||
|
||||
onTestConnectionResponse(iError, oData) {
|
||||
this.testing(false);
|
||||
if (!iError && oData.Result) {
|
||||
if (iError) {
|
||||
this.testingImapError(true);
|
||||
this.testingSieveError(true);
|
||||
this.testingSmtpError(true);
|
||||
this.sieveSettings(false);
|
||||
} else {
|
||||
let bImap = false,
|
||||
bSieve = false;
|
||||
|
||||
|
|
@ -239,11 +244,6 @@ class DomainPopupView extends AbstractViewPopup {
|
|||
} else if (bSieve && !bImap) {
|
||||
this.sieveSettings(true);
|
||||
}
|
||||
} else {
|
||||
this.testingImapError(true);
|
||||
this.testingSieveError(true);
|
||||
this.testingSmtpError(true);
|
||||
this.sieveSettings(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,6 @@ class TemplatePopupView extends AbstractViewPopup {
|
|||
|
||||
if (
|
||||
!iError &&
|
||||
data &&
|
||||
TemplateModel.validJson(data.Result) &&
|
||||
null != data.Result.Body
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewPopup {
|
|||
|
||||
this.capaTwoFactor = Settings.capa(Capa.TwoFactor);
|
||||
|
||||
const fn = iError => iError && this.viewEnable_(false);
|
||||
this.addComputables({
|
||||
viewEnable: {
|
||||
read: this.viewEnable_,
|
||||
|
|
@ -43,21 +44,12 @@ class TwoFactorConfigurationPopupView extends AbstractViewPopup {
|
|||
value = !!value;
|
||||
if (value && this.twoFactorTested()) {
|
||||
this.viewEnable_(value);
|
||||
Remote.enableTwoFactor((iError, data) => {
|
||||
if (iError || !data || !data.Result) {
|
||||
this.viewEnable_(false);
|
||||
}
|
||||
}, true);
|
||||
Remote.enableTwoFactor(fn, value);
|
||||
} else {
|
||||
if (!value) {
|
||||
this.viewEnable_(value);
|
||||
}
|
||||
|
||||
Remote.enableTwoFactor((iError, data) => {
|
||||
if (iError || !data || !data.Result) {
|
||||
this.viewEnable_(false);
|
||||
}
|
||||
}, false);
|
||||
Remote.enableTwoFactor(fn, false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -152,7 +144,17 @@ class TwoFactorConfigurationPopupView extends AbstractViewPopup {
|
|||
this.processing(false);
|
||||
this.clearing(false);
|
||||
|
||||
if (!iError && oData && oData.Result) {
|
||||
if (iError) {
|
||||
this.viewUser('');
|
||||
this.viewEnable_(false);
|
||||
this.twoFactorStatus(false);
|
||||
this.twoFactorTested(false);
|
||||
|
||||
this.viewSecret('');
|
||||
this.viewBackupCodes('');
|
||||
this.viewUrlTitle('');
|
||||
this.viewUrl('');
|
||||
} else {
|
||||
this.viewUser(pString(oData.Result.User));
|
||||
this.viewEnable_(!!oData.Result.Enable);
|
||||
this.twoFactorStatus(!!oData.Result.IsSet);
|
||||
|
|
@ -163,30 +165,20 @@ class TwoFactorConfigurationPopupView extends AbstractViewPopup {
|
|||
|
||||
this.viewUrlTitle(pString(oData.Result.UrlTitle));
|
||||
this.viewUrl(qr.toDataURL({ level: 'M', size: 8, value: this.getQr() }));
|
||||
} else {
|
||||
this.viewUser('');
|
||||
this.viewEnable_(false);
|
||||
this.twoFactorStatus(false);
|
||||
this.twoFactorTested(false);
|
||||
|
||||
this.viewSecret('');
|
||||
this.viewBackupCodes('');
|
||||
this.viewUrlTitle('');
|
||||
this.viewUrl('');
|
||||
}
|
||||
}
|
||||
|
||||
onShowSecretResult(iError, data) {
|
||||
this.secreting(false);
|
||||
|
||||
if (!iError && data && data.Result) {
|
||||
this.viewSecret(pString(data.Result.Secret));
|
||||
this.viewUrlTitle(pString(data.Result.UrlTitle));
|
||||
this.viewUrl(qr.toDataURL({ level: 'M', size: 6, value: this.getQr() }));
|
||||
} else {
|
||||
if (iError) {
|
||||
this.viewSecret('');
|
||||
this.viewUrlTitle('');
|
||||
this.viewUrl('');
|
||||
} else {
|
||||
this.viewSecret(pString(data.Result.Secret));
|
||||
this.viewUrlTitle(pString(data.Result.UrlTitle));
|
||||
this.viewUrl(qr.toDataURL({ level: 'M', size: 6, value: this.getQr() }));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ class TwoFactorTestPopupView extends AbstractViewPopup {
|
|||
|
||||
testCodeCommand() {
|
||||
this.testing(true);
|
||||
Remote.testTwoFactor((iError, data) => {
|
||||
Remote.testTwoFactor(iError => {
|
||||
this.testing(false);
|
||||
this.codeStatus(!iError && data && !!data.Result);
|
||||
this.codeStatus(!iError);
|
||||
|
||||
if (this.koTestedTrigger && this.codeStatus()) {
|
||||
this.koTestedTrigger(true);
|
||||
|
|
|
|||
|
|
@ -850,8 +850,8 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
addRequestedMessage(message.folder, message.uid);
|
||||
|
||||
Remote.message(
|
||||
(iError, data) => {
|
||||
const next = !!(!iError && data && data.Result);
|
||||
iError => {
|
||||
const next = !iError;
|
||||
setTimeout(() => {
|
||||
this.bPrefetch = false;
|
||||
next && this.prefetchNextTick();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue