mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 14:07:04 +03:00
cleanup some code
This commit is contained in:
parent
e566494a87
commit
cb2048f163
14 changed files with 32 additions and 117 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { StorageResultType, ServerSecure, Ports, Notification } from 'Common/Enums';
|
||||
import { StorageResultType, ServerSecure, Notification } from 'Common/Enums';
|
||||
import { pInt, pString } from 'Common/Utils';
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
||||
|
|
@ -125,19 +125,19 @@ class DomainPopupView extends AbstractViewNext {
|
|||
value && this.imapServer() && !this.smtpServer() && this.smtpServer(this.imapServer().replace(/imap/gi, 'smtp'))
|
||||
);
|
||||
|
||||
this.imapSecure.subscribe((value) => {
|
||||
this.imapSecure.subscribe(value => {
|
||||
if (this.enableSmartPorts()) {
|
||||
const port = pInt(this.imapPort());
|
||||
switch (pString(value)) {
|
||||
case '0':
|
||||
case '2':
|
||||
if (Ports.ImapSsl === port) {
|
||||
this.imapPort(pString(Ports.Imap));
|
||||
if (993 === port) {
|
||||
this.imapPort('143');
|
||||
}
|
||||
break;
|
||||
case '1':
|
||||
if (Ports.Imap === port) {
|
||||
this.imapPort(pString(Ports.ImapSsl));
|
||||
if (143 === port) {
|
||||
this.imapPort('993');
|
||||
}
|
||||
break;
|
||||
// no default
|
||||
|
|
@ -145,23 +145,23 @@ class DomainPopupView extends AbstractViewNext {
|
|||
}
|
||||
});
|
||||
|
||||
this.smtpSecure.subscribe((value) => {
|
||||
this.smtpSecure.subscribe(value => {
|
||||
if (this.enableSmartPorts()) {
|
||||
const port = pInt(this.smtpPort());
|
||||
switch (pString(value)) {
|
||||
case '0':
|
||||
if (Ports.SmtpSsl === port || Ports.SmtpStartTls === port) {
|
||||
this.smtpPort(pString(Ports.Smtp));
|
||||
if (465 === port || 587 === port) {
|
||||
this.smtpPort('25');
|
||||
}
|
||||
break;
|
||||
case '1':
|
||||
if (Ports.Smtp === port || Ports.SmtpStartTls === port) {
|
||||
this.smtpPort(pString(Ports.SmtpSsl));
|
||||
if (25 === port || 587 === port) {
|
||||
this.smtpPort('465');
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
if (Ports.Smtp === port || Ports.SmtpSsl === port) {
|
||||
this.smtpPort(pString(Ports.SmtpStartTls));
|
||||
if (25 === port || 465 === port) {
|
||||
this.smtpPort('587');
|
||||
}
|
||||
break;
|
||||
// no default
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext {
|
|||
|
||||
onBuild() {
|
||||
shortcuts.add('`', '', [KeyState.MessageList, KeyState.MessageView, KeyState.Settings], () => {
|
||||
if (this.viewModelVisibility()) {
|
||||
if (this.viewModelVisible) {
|
||||
MessageStore.messageFullScreenMode(false);
|
||||
this.accountMenuDropdownTrigger(true);
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext {
|
|||
|
||||
// shortcuts help
|
||||
shortcuts.add('/', 'shift', [KeyState.MessageList, KeyState.MessageView, KeyState.Settings], () => {
|
||||
if (this.viewModelVisibility()) {
|
||||
if (this.viewModelVisible) {
|
||||
showScreenPopup(require('View/Popup/KeyboardShortcutsHelp'));
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -872,7 +872,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
prefetchNextTick() {
|
||||
if (ifvisible && !this.bPrefetch && !ifvisible.now() && this.viewModelVisibility()) {
|
||||
if (ifvisible && !this.bPrefetch && !ifvisible.now() && this.viewModelVisible) {
|
||||
const message = this.messageList().find(
|
||||
item => item && !hasRequestedMessage(item.folderFullNameRaw, item.uid)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
|
||||
this.showAttachmnetControls = ko.observable(false);
|
||||
|
||||
this.showAttachmnetControlsState = v => Local.set(ClientSideKeyName.MessageAttachmnetControls, !!v);
|
||||
this.showAttachmnetControlsState = v => Local.set(ClientSideKeyName.MessageAttachmentControls, !!v);
|
||||
|
||||
this.allowAttachmnetControls = ko.computed(
|
||||
() => this.attachmentsActions().length && Settings.capa(Capa.AttachmentsActions)
|
||||
|
|
@ -220,7 +220,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
|
||||
if (message) {
|
||||
this.showAttachmnetControls(false);
|
||||
if (Local.get(ClientSideKeyName.MessageAttachmnetControls)) {
|
||||
if (Local.get(ClientSideKeyName.MessageAttachmentControls)) {
|
||||
setTimeout(() => {
|
||||
this.showAttachmnetControls(true);
|
||||
}, 50);
|
||||
|
|
@ -509,7 +509,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
* @returns {boolean}
|
||||
*/
|
||||
escShortcuts() {
|
||||
if (this.viewModelVisibility() && this.message()) {
|
||||
if (this.viewModelVisible && this.message()) {
|
||||
const preview = Layout.NoPreview !== this.layout();
|
||||
if (this.fullScreenMode()) {
|
||||
this.fullScreenMode(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue