From c2d6ee90ac4b78382e26f305f7291b427d23f680 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Wed, 8 Jun 2022 14:54:51 +0200 Subject: [PATCH] Improved message flags/keywords/tags #419 --- dev/Model/Message.js | 38 +++++++++++++++++----------------- dev/Stores/User/Messagelist.js | 11 ++++++++-- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/dev/Model/Message.js b/dev/Model/Message.js index 20cd0c408..6643969ed 100644 --- a/dev/Model/Message.js +++ b/dev/Model/Message.js @@ -35,6 +35,24 @@ const return result; }, + ignoredTags = [ + '$forwarded', + // Mailo + 'sent', + // KMail + '$sent', + '$signed', + '$error', + '$queued', + // GMail + '$replied', + '$attachment', + '$notphishing', + '$phishing', + 'junk', + 'nonjunk' + ], + toggleTag = (message, keyword) => { const lower = keyword.toLowerCase(), isSet = message.flags().includes(lower); @@ -114,24 +132,6 @@ export class MessageModel extends AbstractModel { this.unsubsribeLinks = ko.observableArray(); this.flags = ko.observableArray(); - const ignoredTags = [ - '$forwarded', - // Mailo - 'sent', - // KMail - '$sent', - '$signed', - '$error', - '$queued', - // GMail - '$replied', - '$attachment', - '$notphishing', - '$phishing', - 'junk', - 'nonjunk' - ]; - this.addComputables({ attachmentIconClass: () => FileInfo.getAttachmentsIconClass(this.attachments()), threadsLen: () => this.threads().length, @@ -145,7 +145,7 @@ export class MessageModel extends AbstractModel { // isPhishing: () => this.flags().includes('$phishing'), tagsToHTML: () => this.flags().map(value => - ('\\' == value[0] || '$forwarded' == value) + ('\\' == value[0] || ignoredTags.includes(value)) ? '' : '' + i18n('MESSAGE_TAGS/'+value,0,value) + '' ).join(' '), diff --git a/dev/Stores/User/Messagelist.js b/dev/Stores/User/Messagelist.js index b58b29454..6a95964d4 100644 --- a/dev/Stores/User/Messagelist.js +++ b/dev/Stores/User/Messagelist.js @@ -200,12 +200,19 @@ MessagelistUserStore.reload = (bDropPagePosition = false, bDropCurrentFolderCach } folder.flags(folderInfo.Flags); - folderInfo.PermanentFlags.sort((a, b) => { + let flags = folderInfo.PermanentFlags; + if (flags.includes('\\*')) { + let i = 6; + while (--i) { + flags.includes('$label'+i) || flags.push('$label'+i); + } + } + flags.sort((a, b) => { a = a.toUpperCase(); b = b.toUpperCase(); return (a < b) ? -1 : ((a > b) ? 1 : 0); }); - folder.permanentFlags(folderInfo.PermanentFlags); + folder.permanentFlags(flags); MessagelistUserStore.notifyNewMessages(folder.fullName, collection.NewMessages); }