Skip to content

Commit

Permalink
Improved tags #419
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Jun 3, 2022
1 parent c0994b3 commit 9e4edd8
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 6 deletions.
27 changes: 22 additions & 5 deletions dev/Model/FolderCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,17 @@ export class FolderModel extends AbstractModel {

kolabType: null,

collapsed: true
collapsed: true,

tagsAllowed: false
});

this.flags = ko.observableArray();
this.permanentFlags = ko.observableArray();

this.addSubscribables({
kolabType: sValue => this.metadata[FolderMetadataKeys.KolabFolderType] = sValue
kolabType: sValue => this.metadata[FolderMetadataKeys.KolabFolderType] = sValue,
permanentFlags: aValue => this.tagsAllowed(aValue.includes('\\*'))
});

this.subFolders = ko.observableArray(new FolderCollectionModel);
Expand Down Expand Up @@ -296,9 +302,20 @@ export class FolderModel extends AbstractModel {
}
})
.extend({ notify: 'always' });

this.flags = ko.observableArray();
this.permanentFlags = ko.observableArray();
/*
https://www.rfc-editor.org/rfc/rfc8621.html#section-2
"myRights": {
"mayAddItems": true,
"mayRename": false,
"maySubmit": true,
"mayDelete": false,
"maySetKeywords": true,
"mayRemoveItems": true,
"mayCreateChild": true,
"maySetSeen": true,
"mayReadItems": true
},
*/
}

/**
Expand Down
12 changes: 11 additions & 1 deletion dev/Model/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,21 @@ export class MessageModel extends AbstractModel {
this.flags = ko.observableArray();

const ignoredTags = [
'$forwarded',
// Mailo
'sent',
// KMail
'$sent',
'$signed',
'$error',
'$queued',
'$forwarded'
// GMail
'$replied',
'$attachment',
'$notphishing',
'$phishing',
'junk',
'nonjunk'
];

this.addComputables({
Expand Down
5 changes: 5 additions & 0 deletions dev/Stores/User/Messagelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ MessagelistUserStore.reload = (bDropPagePosition = false, bDropCurrenFolderCache
}

folder.flags(folderInfo.Flags);
folderInfo.PermanentFlags.sort((a, b) => {
a = a.toUpperCase();
b = b.toUpperCase();
return (a < b) ? -1 : ((a > b) ? 1 : 0);
});
folder.permanentFlags(folderInfo.PermanentFlags);

MessagelistUserStore.initUidNextAndNewMessages(folder.fullName, folderInfo.UidNext, collection.NewMessages);
Expand Down
2 changes: 2 additions & 0 deletions dev/View/User/MailBox/MessageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ export class MailMessageView extends AbstractViewRight {
)
},

tagsAllowed: () => FolderUserStore.currentFolder() ? FolderUserStore.currentFolder().tagsAllowed() : false,

messageVisibility: () => !MessageUserStore.loading() && !!currentMessage(),

canBeRepliedOrForwarded: () => !this.isDraftFolder() && this.messageVisibility(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
</table>
</div>
<div class="hasVirus" data-bind="visible: message().hasVirus()" data-i18n="MESSAGE/HAS_VIRUS_WARNING"></div>
<!-- ko if: tagsAllowed -->
<div class="messageTags">
<span data-i18n="MESSAGE/TAGS"></span>:
<span data-bind="html: message().tagsToHTML()"></span>
Expand All @@ -207,6 +208,7 @@
</ul>
</div>
</div>
<!-- /ko -->
</div>
<div id="messageItem" data-bind="css: message().lineAsCss()">
<div tabindex="0" data-bind="hasfocus: messageDomFocused">
Expand Down

0 comments on commit 9e4edd8

Please sign in to comment.