Improved handling of imap message flags/keywords

This commit is contained in:
the-djmaze 2022-05-31 20:38:35 +02:00
parent 0ebfa6af23
commit 899648d8e4
6 changed files with 29 additions and 57 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -133,11 +133,7 @@
<div class="flagParent fontastic"></div>
<div class="senderParent actionHandle" data-bind="attr: {'title': senderClearEmailsString}">
<!-- ko if: isAnswered --><i class="replyFlag fontastic"></i><!-- /ko -->
<!-- ko if: isForwarded --><i class="forwardFlag fontastic"></i><!-- /ko -->
<!-- ko text: senderEmailsString --><!-- /ko -->
</div>
<div class="senderParent actionHandle" data-bind="attr: {'title': senderClearEmailsString}, text: senderEmailsString"></div>
<div class="attachmentParent actionHandle">
<i data-bind="css: attachmentIconClass"></i>