Improved mailbox handling of empty message subject and messagelist folder detection

This commit is contained in:
the-djmaze 2022-08-04 12:18:07 +02:00
parent 9559986499
commit eb0cd796b0
8 changed files with 56 additions and 73 deletions

View file

@ -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()

View file

@ -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,

View file

@ -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;

View file

@ -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;

View file

@ -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;
});
}