diff --git a/dev/Model/Message.js b/dev/Model/Message.js index 4c19e1826..252e0a039 100644 --- a/dev/Model/Message.js +++ b/dev/Model/Message.js @@ -375,7 +375,6 @@ export class MessageModel extends AbstractModel { focused: this.focused(), important: this.isImportant(), withAttachments: !!this.attachments().length, - emptySubject: !this.subject(), // hasChildrenMessage: 1 < this.threadsLen(), hasUnseenSubMessage: this.hasUnseenSubMessage(), hasFlaggedSubMessage: this.hasFlaggedSubMessage() diff --git a/dev/Screen/User/MailBox.js b/dev/Screen/User/MailBox.js index 851e23ff4..b40134792 100644 --- a/dev/Screen/User/MailBox.js +++ b/dev/Screen/User/MailBox.js @@ -1,10 +1,10 @@ import { Scope } from 'Common/Enums'; import { Layout, ClientSideKeyNameMessageListSize } from 'Common/EnumsUser'; -import { doc, leftPanelDisabled, moveAction, Settings, elementById } from 'Common/Globals'; +import { doc, createElement, leftPanelDisabled, moveAction, Settings, elementById } from 'Common/Globals'; import { pString, pInt } from 'Common/Utils'; import { setLayoutResizer } from 'Common/UtilsUser'; import { getFolderFromCacheList, getFolderFullName, getFolderInboxName } from 'Common/Cache'; -import { i18n } from 'Common/Translator'; +import { i18n, initOnStartOrLangChange } from 'Common/Translator'; import { SettingsUserStore } from 'Stores/User/Settings'; import { AppUserStore } from 'Stores/User/App'; @@ -22,6 +22,12 @@ import { AbstractScreen } from 'Knoin/AbstractScreen'; export class MailBoxUserScreen extends AbstractScreen { constructor() { + var styleSheet = createElement('style'); + doc.head.appendChild(styleSheet); + initOnStartOrLangChange(() => + styleSheet.innerText = '.subjectParent:empty::after,.subjectParent .subject:empty::after' + +'{content:"'+i18n('MESSAGE/EMPTY_SUBJECT_TEXT')+'"}' + ); super('mailbox', [ SystemDropDownUserView, MailFolderList, diff --git a/dev/Styles/User/MessageList.less b/dev/Styles/User/MessageList.less index cc66fbc0e..47af6e44e 100644 --- a/dev/Styles/User/MessageList.less +++ b/dev/Styles/User/MessageList.less @@ -246,6 +246,11 @@ html:not(rl-mobile) { white-space: nowrap; } + .subjectParent:empty { + font-style: italic; + opacity: 0.5; + } + .threadsCountParent { display: inline; overflow: hidden; @@ -266,11 +271,6 @@ html:not(rl-mobile) { border-color: #666; } - &.emptySubject .subjectParent { - font-style: italic; - opacity: 0.5; - } - .threads-len { border-radius: 6px; border: 1px solid #ccc; diff --git a/dev/Styles/User/MessageView.less b/dev/Styles/User/MessageView.less index e376fc409..958452b0c 100644 --- a/dev/Styles/User/MessageView.less +++ b/dev/Styles/User/MessageView.less @@ -113,12 +113,16 @@ html.rl-no-preview-pane { margin-bottom: 8px; } - .subject, .emptySubjectText { + .subject { flex-grow: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } + .subject:empty { + font-style: italic; + opacity: 0.5; + } .messageButtons { margin-top: 5px; @@ -166,12 +170,6 @@ html.rl-no-preview-pane { } } - .emptySubjectText { - font-style: italic; - font-weight: normal; - color: #999; - } - .hasVirus { background: #f00; color: #fff; diff --git a/dev/View/User/MailBox/MessageList.js b/dev/View/User/MailBox/MessageList.js index b023e0c95..f963189f3 100644 --- a/dev/View/User/MailBox/MessageList.js +++ b/dev/View/User/MailBox/MessageList.js @@ -20,7 +20,7 @@ import { isFullscreen, toggleFullscreen } from 'Common/Fullscreen'; import { mailBox, serverRequest } from 'Common/Links'; import { Selector } from 'Common/Selector'; -import { i18n, initOnStartOrLangChange } from 'Common/Translator'; +import { i18n } from 'Common/Translator'; import { getFolderFromCacheList, @@ -55,14 +55,14 @@ const */ listAction = (...args) => MessagelistUserStore.setAction(...args); +let + iGoToUpOrDownTimeout = 0, + sLastSearchValue = ''; + export class MailMessageList extends AbstractViewRight { constructor() { super(); - this.emptySubjectValue = ''; - - this.iGoToUpOrDownTimeout = 0; - this.newMoveToFolder = !!SettingsGet('NewMoveToFolder'); this.allowSearch = SettingsCapa('Search'); @@ -76,19 +76,10 @@ export class MailMessageList extends AbstractViewRight { this.isMobile = ThemeStore.isMobile; this.leftPanelDisabled = leftPanelDisabled; - this.messageListSearch = MessagelistUserStore.listSearch; - this.messageListError = MessagelistUserStore.error; - this.popupVisibility = arePopupsVisible; this.useCheckboxesInList = SettingsUserStore.useCheckboxesInList; - this.messageListThreadUid = MessagelistUserStore.endThreadUid; - - this.messageListIsLoading = MessagelistUserStore.isLoading; - - initOnStartOrLangChange(() => this.emptySubjectValue = i18n('MESSAGE_LIST/EMPTY_SUBJECT_TEXT')); - this.userUsageProc = FolderUserStore.quotaPercentage; this.addObservables({ @@ -99,15 +90,13 @@ export class MailMessageList extends AbstractViewRight { dragOverArea: null, dragOverBodyArea: null, - inputMessageListSearchFocus: false + focusSearch: false }); // append drag and drop this.dragOver = ko.observable(false).extend({ throttle: 1 }); this.dragOverEnter = ko.observable(false).extend({ throttle: 1 }); - this.sLastSearchValue = ''; - this.addComputables({ sortSupported: () => @@ -136,9 +125,9 @@ export class MailMessageList extends AbstractViewRight { } }, - inputProxyMessageListSearch: { + inputSearch: { read: MessagelistUserStore.mainSearch, - write: value => this.sLastSearchValue = value + write: value => sLastSearchValue = value }, isIncompleteChecked: () => { @@ -146,33 +135,28 @@ export class MailMessageList extends AbstractViewRight { return c && MessagelistUserStore().length > c; }, - hasMessages: () => 0 < MessagelistUserStore().length, - isSpamFolder: () => (FolderUserStore.spamFolder() || 0) === MessagelistUserStore().Folder, - isSpamDisabled: () => UNUSED_OPTION_VALUE === FolderUserStore.spamFolder(), - isTrashFolder: () => (FolderUserStore.trashFolder() || 0) === MessagelistUserStore().Folder, isDraftFolder: () => (FolderUserStore.draftsFolder() || 0) === MessagelistUserStore().Folder, - isSentFolder: () => (FolderUserStore.sentFolder() || 0) === MessagelistUserStore().Folder, + archiveAllowed: () => + (FolderUserStore.archiveFolder() || 0) !== MessagelistUserStore().Folder + && UNUSED_OPTION_VALUE !== FolderUserStore.archiveFolder() + && !this.isDraftFolder(), - isArchiveFolder: () => (FolderUserStore.archiveFolder() || 0) === MessagelistUserStore().Folder, + spamAllowed: () => UNUSED_OPTION_VALUE !== FolderUserStore.spamFolder() + && (FolderUserStore.sentFolder() || 0) !== MessagelistUserStore().Folder + && !this.isDraftFolder(), - isArchiveDisabled: () => UNUSED_OPTION_VALUE === FolderUserStore.archiveFolder(), + isSpamVisible: () => !this.isSpamFolder() && this.spamAllowed(), - isArchiveVisible: () => !this.isArchiveFolder() && !this.isArchiveDisabled() && !this.isDraftFolder(), + isUnSpamVisible: () => this.isSpamFolder() && this.spamAllowed(), - isSpamVisible: () => - !this.isSpamFolder() && !this.isSpamDisabled() && !this.isDraftFolder() && !this.isSentFolder(), + mobileCheckedStateShow: () => ThemeStore.isMobile() ? MessagelistUserStore.listChecked().length : 1, - isUnSpamVisible: () => - this.isSpamFolder() && !this.isSpamDisabled() && !this.isDraftFolder() && !this.isSentFolder(), - - mobileCheckedStateShow: () => ThemeStore.isMobile() ? 0 < MessagelistUserStore.listChecked().length : true, - - mobileCheckedStateHide: () => ThemeStore.isMobile() ? !MessagelistUserStore.listChecked().length : true, + mobileCheckedStateHide: () => ThemeStore.isMobile() ? !MessagelistUserStore.listChecked().length : 1, sortText: () => { let mode = FolderUserStore.sortMode(), @@ -188,8 +172,6 @@ export class MailMessageList extends AbstractViewRight { } }); - this.hasCheckedOrSelectedLines = MessagelistUserStore.hasCheckedOrSelected, - this.selector = new Selector( MessagelistUserStore, MessagelistUserStore.selectedMessage, @@ -364,8 +346,8 @@ export class MailMessageList extends AbstractViewRight { return false; } - clearTimeout(this.iGoToUpOrDownTimeout); - this.iGoToUpOrDownTimeout = setTimeout(() => { + clearTimeout(iGoToUpOrDownTimeout); + iGoToUpOrDownTimeout = setTimeout(() => { let prev, next, temp, current; this.messageListPaginator().find(item => { @@ -412,7 +394,7 @@ export class MailMessageList extends AbstractViewRight { cancelSearch() { MessagelistUserStore.mainSearch(''); - this.inputMessageListSearchFocus(false); + this.focusSearch(false); } cancelThreadUid() { @@ -684,7 +666,7 @@ export class MailMessageList extends AbstractViewRight { addShortcut('enter,open', '', Scope.MessageList, () => { if (formFieldFocused()) { - MessagelistUserStore.mainSearch(this.sLastSearchValue); + MessagelistUserStore.mainSearch(sLastSearchValue); return false; } if (MessageUserStore.message() && this.useAutoSelect()) { @@ -778,7 +760,7 @@ export class MailMessageList extends AbstractViewRight { if (SettingsCapa('Search')) { // search input focus addShortcut('/', '', [Scope.MessageList, Scope.MessageView], () => { - this.inputMessageListSearchFocus(true); + this.focusSearch(true); return false; }); } diff --git a/snappymail/v/0.0.0/app/localization/en/user.json b/snappymail/v/0.0.0/app/localization/en/user.json index b09b6cac9..fe4dc8ae9 100644 --- a/snappymail/v/0.0.0/app/localization/en/user.json +++ b/snappymail/v/0.0.0/app/localization/en/user.json @@ -107,7 +107,6 @@ "EMPTY_SEARCH_LIST": "No messages matched your search.", "SEARCH_RESULT_FOR": "Search results for \"%SEARCH%\"", "BACK_TO_MESSAGE_LIST": "back to message list", - "EMPTY_SUBJECT_TEXT": "(No subject)", "PUT_MESSAGE_HERE": "Drop message here to view it in the list", "TODAY_AT": "today at %TIME%", "YESTERDAY_AT": "yesterday at %TIME%", diff --git a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageList.html b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageList.html index 0c391e845..d4f96ccb9 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageList.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageList.html @@ -30,7 +30,7 @@