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(), isImportant: () => MessagePriority.High === this.priority(),
hasAttachments: () => this.attachments().hasVisible(), hasAttachments: () => this.attachments().hasVisible(),
isDeleted: () => this.flags().includes('\\deleted'), isUnseen: () => !this.flags().includes('\\seen'),
isUnseen: () => !this.flags().includes('\\seen') /* || this.flags().includes('\\unseen')*/,
isFlagged: () => this.flags().includes('\\flagged'), isFlagged: () => this.flags().includes('\\flagged'),
isAnswered: () => this.flags().includes('\\answered'),
isForwarded: () => this.flags().includes('$forwarded'),
isReadReceipt: () => this.flags().includes('$mdnsent') isReadReceipt: () => this.flags().includes('$mdnsent')
// isJunk: () => this.flags().includes('$junk') && !this.flags().includes('$nonjunk'), // isJunk: () => this.flags().includes('$junk') && !this.flags().includes('$nonjunk'),
// isPhishing: () => this.flags().includes('$phishing') // isPhishing: () => this.flags().includes('$phishing')
@ -291,13 +288,9 @@ export class MessageModel extends AbstractModel {
let classes = []; let classes = [];
forEachObjectEntry({ forEachObjectEntry({
deleted: this.deleted(), deleted: this.deleted(),
'deleted-mark': this.isDeleted(),
selected: this.selected(), selected: this.selected(),
checked: this.checked(), checked: this.checked(),
flagged: this.isFlagged(),
unseen: this.isUnseen(), unseen: this.isUnseen(),
answered: this.isAnswered(),
forwarded: this.isForwarded(),
focused: this.focused(), focused: this.focused(),
important: this.isImportant(), important: this.isImportant(),
withAttachments: !!this.attachments().length, withAttachments: !!this.attachments().length,
@ -306,9 +299,7 @@ export class MessageModel extends AbstractModel {
hasUnseenSubMessage: this.hasUnseenSubMessage(), hasUnseenSubMessage: this.hasUnseenSubMessage(),
hasFlaggedSubMessage: this.hasFlaggedSubMessage() hasFlaggedSubMessage: this.hasFlaggedSubMessage()
}, (key, value) => value && classes.push(key)); }, (key, value) => value && classes.push(key));
this.flags().forEach(value => { this.flags().forEach(value => classes.push('flag-'+value));
'\\' !== value[0] && '$forwarded' !== value && classes.push('flag-'+value);
});
return classes.join(' '); return classes.join(' ');
} }
@ -578,19 +569,4 @@ export class MessageModel extends AbstractModel {
return result.html || plainToHtml(this.plain()); 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))) ? messageList.filter(item => item && uidForRemove.includes(pInt(item.uid)))
: []; : [];
messages.forEach(item => { messages.forEach(item => item && item.isUnseen() && ++unseenCount);
if (item && item.isUnseen()) {
++unseenCount;
}
});
if (fromFolder && !copy) { if (fromFolder && !copy) {
fromFolder.messageCountAll( fromFolder.messageCountAll(

View file

@ -216,7 +216,7 @@ html:not(rl-mobile) {
margin-right:5px margin-right:5px
} }
&.deleted-mark { &.flag-\\deleted {
opacity: .7; opacity: .7;
.subjectParent { .subjectParent {
text-decoration: line-through; text-decoration: line-through;
@ -242,8 +242,6 @@ html:not(rl-mobile) {
.attachmentParent { .attachmentParent {
position: relative; position: relative;
margin: 2px 10px 0 5px; margin: 2px 10px 0 5px;
color: #666;
text-shadow: 0 1px 0 #eee;
} }
.senderParent, .subjectParent { .senderParent, .subjectParent {
@ -340,15 +338,15 @@ html:not(rl-mobile) {
.flagParent { .flagParent {
padding: 0 10px 0 5px; padding: 0 10px 0 5px;
} }
&.flagged .flagParent::after, &.flag-\\flagged .flagParent::after,
&.hasFlaggedSubMessage .flagParent::after { &.hasFlaggedSubMessage .flagParent::after {
color: orange; color: orange;
content: '★'; /*⚑*/ content: '★'; /*⚑*/
} }
&:not(.flagged):not(.hasFlaggedSubMessage) .flagParent::after { &:not(.flag-\\flagged):not(.hasFlaggedSubMessage) .flagParent::after {
content: '☆'; /*⚐*/ content: '☆'; /*⚐*/
} }
&:not(.flagged):not(.hasFlaggedSubMessage) .flagParent:not(:hover) { &:not(.flag-\\flagged):not(.hasFlaggedSubMessage) .flagParent:not(:hover) {
opacity: 0.5; 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 */ /* Thunderbird labels */
.flag-\$label5 .checkboxMessage { background-color: #808; } .flag-\$label5 .checkboxMessage { background-color: #808; }
.flag-\$label4 .checkboxMessage { background-color: #00F; } .flag-\$label4 .checkboxMessage { background-color: #00F; }

View file

@ -571,15 +571,7 @@ export class MailMessageList extends AbstractViewRight {
seenMessagesFast(seen) { seenMessagesFast(seen) {
const checked = MessagelistUserStore.listCheckedOrSelected(); const checked = MessagelistUserStore.listCheckedOrSelected();
if (checked.length) { if (checked.length && null != seen) {
if (undefined === seen) {
const unseen = checked.filter(message => message.isUnseen());
listAction(
checked[0].folder,
unseen.length ? MessageSetAction.SetSeen : MessageSetAction.UnsetSeen,
checked
);
} else {
listAction( listAction(
checked[0].folder, checked[0].folder,
seen ? MessageSetAction.SetSeen : MessageSetAction.UnsetSeen, seen ? MessageSetAction.SetSeen : MessageSetAction.UnsetSeen,
@ -587,7 +579,6 @@ export class MailMessageList extends AbstractViewRight {
); );
} }
} }
}
gotoPage(page) { gotoPage(page) {
page && hasher.setHash( page && hasher.setHash(

View file

@ -7,6 +7,8 @@
* *
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.
*
* https://www.iana.org/assignments/imap-jmap-keywords/imap-jmap-keywords.xhtml
*/ */
namespace MailSo\Imap\Enumerations; namespace MailSo\Imap\Enumerations;

View file

@ -133,11 +133,7 @@
<div class="flagParent fontastic"></div> <div class="flagParent fontastic"></div>
<div class="senderParent actionHandle" data-bind="attr: {'title': senderClearEmailsString}"> <div class="senderParent actionHandle" data-bind="attr: {'title': senderClearEmailsString}, text: senderEmailsString"></div>
<!-- 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="attachmentParent actionHandle"> <div class="attachmentParent actionHandle">
<i data-bind="css: attachmentIconClass"></i> <i data-bind="css: attachmentIconClass"></i>