diff --git a/dev/View/Admin/Login.js b/dev/View/Admin/Login.js index 85ab840f7..e2cf1e2f3 100644 --- a/dev/View/Admin/Login.js +++ b/dev/View/Admin/Login.js @@ -40,11 +40,9 @@ class LoginAdminView extends AbstractViewNext { this.password.subscribe(() => this.passwordError(false)); - this.loginError.subscribe((v) => this.loginErrorAnimation(!!v)); + this.loginError.subscribe(v => this.loginErrorAnimation(!!v)); - this.passwordError.subscribe((v) => { - this.passwordErrorAnimation(!!v); - }); + this.passwordError.subscribe(v => this.passwordErrorAnimation(!!v)); this.submitRequest = ko.observable(false); this.submitError = ko.observable(''); diff --git a/dev/View/Popup/Domain.js b/dev/View/Popup/Domain.js index 1afef6748..685879358 100644 --- a/dev/View/Popup/Domain.js +++ b/dev/View/Popup/Domain.js @@ -35,23 +35,11 @@ class DomainPopupView extends AbstractViewNext { this.testingSieveErrorDesc = ko.observable(''); this.testingSmtpErrorDesc = ko.observable(''); - this.testingImapError.subscribe((value) => { - if (!value) { - this.testingImapErrorDesc(''); - } - }); + this.testingImapError.subscribe(value => value || this.testingImapErrorDesc('')); - this.testingSieveError.subscribe((value) => { - if (!value) { - this.testingSieveErrorDesc(''); - } - }); + this.testingSieveError.subscribe(value => value || this.testingSieveErrorDesc('')); - this.testingSmtpError.subscribe((value) => { - if (!value) { - this.testingSmtpErrorDesc(''); - } - }); + this.testingSmtpError.subscribe(value => value || this.testingSmtpErrorDesc('')); this.imapServerFocus = ko.observable(false); this.sieveServerFocus = ko.observable(false); @@ -123,28 +111,20 @@ class DomainPopupView extends AbstractViewNext { this.canBeTested = ko.computed(() => !this.testing() && this.domainIsComputed()); this.canBeSaved = ko.computed(() => !this.saving() && this.domainIsComputed()); - this.page.subscribe(() => { - this.sieveSettings(false); - }); + this.page.subscribe(() => this.sieveSettings(false)); // smart form improvements - this.imapServerFocus.subscribe((value) => { - if (value && this.name() && !this.imapServer()) { - this.imapServer(this.name().replace(/[.]?[*][.]?/g, '')); - } - }); + this.imapServerFocus.subscribe(value => + value && this.name() && !this.imapServer() && this.imapServer(this.name().replace(/[.]?[*][.]?/g, '')) + ); - this.sieveServerFocus.subscribe((value) => { - if (value && this.imapServer() && !this.sieveServer()) { - this.sieveServer(this.imapServer()); - } - }); + this.sieveServerFocus.subscribe(value => + value && this.imapServer() && !this.sieveServer() && this.sieveServer(this.imapServer()) + ); - this.smtpServerFocus.subscribe((value) => { - if (value && this.imapServer() && !this.smtpServer()) { - this.smtpServer(this.imapServer().replace(/imap/gi, 'smtp')); - } - }); + this.smtpServerFocus.subscribe(value => + value && this.imapServer() && !this.smtpServer() && this.smtpServer(this.imapServer().replace(/imap/gi, 'smtp')) + ); this.imapSecure.subscribe((value) => { if (this.enableSmartPorts()) { diff --git a/dev/View/User/Login.js b/dev/View/User/Login.js index 5e51979a0..70484fada 100644 --- a/dev/View/User/Login.js +++ b/dev/View/User/Login.js @@ -79,39 +79,23 @@ class LoginUserView extends AbstractViewNext { this.additionalCode.visibility(false); }); - this.password.subscribe(() => { - this.passwordError(false); - }); + this.password.subscribe(() => this.passwordError(false)); - this.additionalCode.subscribe(() => { - this.additionalCode.error(false); - }); + this.additionalCode.subscribe(() => this.additionalCode.error(false)); - this.additionalCode.visibility.subscribe(() => { - this.additionalCode.error(false); - }); + this.additionalCode.visibility.subscribe(() => this.additionalCode.error(false)); - this.emailError.subscribe((bV) => { - this.emailErrorAnimation(!!bV); - }); + this.emailError.subscribe(bV => this.emailErrorAnimation(!!bV)); - this.passwordError.subscribe((bV) => { - this.passwordErrorAnimation(!!bV); - }); + this.passwordError.subscribe(bV => this.passwordErrorAnimation(!!bV)); - this.additionalCode.error.subscribe((bV) => { - this.additionalCode.errorAnimation(!!bV); - }); + this.additionalCode.error.subscribe(bV => this.additionalCode.errorAnimation(!!bV)); this.submitRequest = ko.observable(false); this.submitError = ko.observable(''); this.submitErrorAddidional = ko.observable(''); - this.submitError.subscribe((value) => { - if (!value) { - this.submitErrorAddidional(''); - } - }); + this.submitError.subscribe(value => value || this.submitErrorAddidional('')); this.allowLanguagesOnLogin = AppStore.allowLanguagesOnLogin; @@ -125,9 +109,7 @@ class LoginUserView extends AbstractViewNext { this.signMeType = ko.observable(LoginSignMeType.Unused); - this.signMeType.subscribe((iValue) => { - this.signMe(LoginSignMeType.DefaultOn === iValue); - }); + this.signMeType.subscribe(iValue => this.signMe(LoginSignMeType.DefaultOn === iValue)); this.signMeVisibility = ko.computed(() => LoginSignMeType.Unused !== this.signMeType()); diff --git a/dev/View/User/MailBox/MessageView.js b/dev/View/User/MailBox/MessageView.js index c9a9adf04..a07a2a93b 100644 --- a/dev/View/User/MailBox/MessageView.js +++ b/dev/View/User/MailBox/MessageView.js @@ -55,13 +55,13 @@ class MessageViewMailBoxUserView extends AbstractViewNext { let lastEmail = ''; - const createCommandReplyHelper = (type) => + const createCommandReplyHelper = type => createCommand(() => { this.lastReplyAction(type); this.replyOrforward(type); - }, this.canBeRepliedOrForwarded); + }, this.canBeRepliedOrForwarded), - const createCommandActionHelper = (folderType, useFolder) => + createCommandActionHelper = (folderType, useFolder) => createCommand(() => { const message = this.message(); if (message && this.allowMessageListActions) { @@ -209,10 +209,8 @@ class MessageViewMailBoxUserView extends AbstractViewNext { this.viewFromDkimStatusTitle = ko.computed(() => { const status = this.viewFromDkimData(); if (Array.isNotEmpty(status)) { - if (status[0] && status[1]) { - return status[1]; - } else if (status[0]) { - return 'DKIM: ' + status[0]; + if (status[0]) { + return status[1] || 'DKIM: ' + status[0]; } }