From 899648d8e4d20c91cd6c30399f52578b20f91b94 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Tue, 31 May 2022 20:38:35 +0200 Subject: [PATCH] Improved handling of imap message flags/keywords --- dev/Model/Message.js | 28 ++----------------- dev/Stores/User/Messagelist.js | 6 +--- dev/Styles/User/MessageList.less | 23 +++++++++++---- dev/View/User/MailBox/MessageList.js | 21 ++++---------- .../MailSo/Imap/Enumerations/MessageFlag.php | 2 ++ .../templates/Views/User/MailMessageList.html | 6 +--- 6 files changed, 29 insertions(+), 57 deletions(-) diff --git a/dev/Model/Message.js b/dev/Model/Message.js index acb582304..ab46130ac 100644 --- a/dev/Model/Message.js +++ b/dev/Model/Message.js @@ -97,11 +97,8 @@ export class MessageModel extends AbstractModel { isImportant: () => MessagePriority.High === this.priority(), hasAttachments: () => this.attachments().hasVisible(), - isDeleted: () => this.flags().includes('\\deleted'), - isUnseen: () => !this.flags().includes('\\seen') /* || this.flags().includes('\\unseen')*/, + isUnseen: () => !this.flags().includes('\\seen'), isFlagged: () => this.flags().includes('\\flagged'), - isAnswered: () => this.flags().includes('\\answered'), - isForwarded: () => this.flags().includes('$forwarded'), isReadReceipt: () => this.flags().includes('$mdnsent') // isJunk: () => this.flags().includes('$junk') && !this.flags().includes('$nonjunk'), // isPhishing: () => this.flags().includes('$phishing') @@ -291,13 +288,9 @@ export class MessageModel extends AbstractModel { let classes = []; forEachObjectEntry({ deleted: this.deleted(), - 'deleted-mark': this.isDeleted(), selected: this.selected(), checked: this.checked(), - flagged: this.isFlagged(), unseen: this.isUnseen(), - answered: this.isAnswered(), - forwarded: this.isForwarded(), focused: this.focused(), important: this.isImportant(), withAttachments: !!this.attachments().length, @@ -306,9 +299,7 @@ export class MessageModel extends AbstractModel { hasUnseenSubMessage: this.hasUnseenSubMessage(), hasFlaggedSubMessage: this.hasFlaggedSubMessage() }, (key, value) => value && classes.push(key)); - this.flags().forEach(value => { - '\\' !== value[0] && '$forwarded' !== value && classes.push('flag-'+value); - }); + this.flags().forEach(value => classes.push('flag-'+value)); return classes.join(' '); } @@ -578,19 +569,4 @@ export class MessageModel extends AbstractModel { return result.html || plainToHtml(this.plain()); } - /** - * @returns {string} - */ - flagHash() { - return [ - this.deleted(), - this.isDeleted(), - this.isUnseen(), - this.isFlagged(), - this.isAnswered(), - this.isForwarded(), - this.isReadReceipt() - ].join(','); - } - } diff --git a/dev/Stores/User/Messagelist.js b/dev/Stores/User/Messagelist.js index d24848ade..1b3750664 100644 --- a/dev/Stores/User/Messagelist.js +++ b/dev/Stores/User/Messagelist.js @@ -332,11 +332,7 @@ MessagelistUserStore.removeMessagesFromList = ( ? messageList.filter(item => item && uidForRemove.includes(pInt(item.uid))) : []; - messages.forEach(item => { - if (item && item.isUnseen()) { - ++unseenCount; - } - }); + messages.forEach(item => item && item.isUnseen() && ++unseenCount); if (fromFolder && !copy) { fromFolder.messageCountAll( diff --git a/dev/Styles/User/MessageList.less b/dev/Styles/User/MessageList.less index 2e9283a7e..55778d506 100644 --- a/dev/Styles/User/MessageList.less +++ b/dev/Styles/User/MessageList.less @@ -216,7 +216,7 @@ html:not(rl-mobile) { margin-right:5px } - &.deleted-mark { + &.flag-\\deleted { opacity: .7; .subjectParent { text-decoration: line-through; @@ -242,8 +242,6 @@ html:not(rl-mobile) { .attachmentParent { position: relative; margin: 2px 10px 0 5px; - color: #666; - text-shadow: 0 1px 0 #eee; } .senderParent, .subjectParent { @@ -340,15 +338,15 @@ html:not(rl-mobile) { .flagParent { padding: 0 10px 0 5px; } - &.flagged .flagParent::after, + &.flag-\\flagged .flagParent::after, &.hasFlaggedSubMessage .flagParent::after { color: orange; content: '★'; /*⚑*/ } - &:not(.flagged):not(.hasFlaggedSubMessage) .flagParent::after { + &:not(.flag-\\flagged):not(.hasFlaggedSubMessage) .flagParent::after { content: '☆'; /*⚐*/ } - &:not(.flagged):not(.hasFlaggedSubMessage) .flagParent:not(:hover) { + &:not(.flag-\\flagged):not(.hasFlaggedSubMessage) .flagParent:not(:hover) { opacity: 0.5; } } @@ -445,6 +443,19 @@ html:not(.rl-mobile):not(.rl-side-preview-pane) { } } +.senderParent::before { + font-family: snappymail; +} +.flag-\\answered .senderParent::before { + content: '← '; +} +.flag-\$forwarded .senderParent::before { + content: '→ '; +} +.flag-\\answered.flag-\$forwarded .senderParent::before { + content: '←→ '; +} + /* Thunderbird labels */ .flag-\$label5 .checkboxMessage { background-color: #808; } .flag-\$label4 .checkboxMessage { background-color: #00F; } diff --git a/dev/View/User/MailBox/MessageList.js b/dev/View/User/MailBox/MessageList.js index 4b5f6595a..b49fd1dc9 100644 --- a/dev/View/User/MailBox/MessageList.js +++ b/dev/View/User/MailBox/MessageList.js @@ -571,21 +571,12 @@ export class MailMessageList extends AbstractViewRight { seenMessagesFast(seen) { const checked = MessagelistUserStore.listCheckedOrSelected(); - if (checked.length) { - if (undefined === seen) { - const unseen = checked.filter(message => message.isUnseen()); - listAction( - checked[0].folder, - unseen.length ? MessageSetAction.SetSeen : MessageSetAction.UnsetSeen, - checked - ); - } else { - listAction( - checked[0].folder, - seen ? MessageSetAction.SetSeen : MessageSetAction.UnsetSeen, - checked - ); - } + if (checked.length && null != seen) { + listAction( + checked[0].folder, + seen ? MessageSetAction.SetSeen : MessageSetAction.UnsetSeen, + checked + ); } } diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/MessageFlag.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/MessageFlag.php index 467938643..c42865ed8 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/MessageFlag.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/MessageFlag.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * https://www.iana.org/assignments/imap-jmap-keywords/imap-jmap-keywords.xhtml */ namespace MailSo\Imap\Enumerations; 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 7d35eb900..dce497560 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 @@ -133,11 +133,7 @@
-
- - - -
+