diff --git a/dev/Common/EnumsUser.js b/dev/Common/EnumsUser.js index 33ba23bf9..4b10597c0 100644 --- a/dev/Common/EnumsUser.js +++ b/dev/Common/EnumsUser.js @@ -14,6 +14,20 @@ export const FolderType = { NotSpam: 80 }; +/** + * @enum {string} + */ +export const FolderMetadataKeys = { + // RFC 5464 + Comment: '/private/comment', + CommentShared: '/shared/comment', + // RFC 6154 + SpecialUse: '/private/specialuse', + // Kolab + KolabFolderType: '/private/vendor/kolab/folder-type', + KolabFolderTypeShared: '/shared/vendor/kolab/folder-type' +}; + /** * @enum {string} */ diff --git a/dev/Model/FolderCollection.js b/dev/Model/FolderCollection.js index 69ad35c7a..92d76a615 100644 --- a/dev/Model/FolderCollection.js +++ b/dev/Model/FolderCollection.js @@ -2,7 +2,7 @@ import { AbstractCollectionModel } from 'Model/AbstractCollection'; import { UNUSED_OPTION_VALUE } from 'Common/Consts'; import { isArray, pInt } from 'Common/Utils'; -import { ClientSideKeyName, FolderType } from 'Common/EnumsUser'; +import { ClientSideKeyName, FolderType, FolderMetadataKeys } from 'Common/EnumsUser'; import * as Cache from 'Common/Cache'; import { Settings, SettingsGet } from 'Common/Globals'; @@ -210,6 +210,8 @@ export class FolderModel extends AbstractModel { privateMessageCountAll: 0, privateMessageCountUnread: 0, + kolab: null, + collapsedPrivate: true }); @@ -227,6 +229,9 @@ export class FolderModel extends AbstractModel { if (folder) { folder.deep = json.FullNameRaw.split(folder.delimiter).length - 1; + let type = folder.metadata[FolderMetadataKeys.KolabFolderType] || folder.metadata[FolderMetadataKeys.KolabFolderTypeShared]; + (type && !type.includes('mail.')) ? folder.kolab(type) : 0; + folder.messageCountAll = ko.computed({ read: folder.privateMessageCountAll, write: (iValue) => { @@ -306,7 +311,7 @@ export class FolderModel extends AbstractModel { canBeSubscribed: () => Settings.app('useImapSubscribe') && !(folder.isSystemFolder() | !SettingsUserStore.hideUnsubscribed() | !folder.selectable()), - canBeSelected: () => !(folder.isSystemFolder() | !folder.selectable()), + canBeSelected: () => !(folder.isSystemFolder() | !folder.selectable() | folder.kolab()), localName: () => { let name = folder.name(); diff --git a/dev/View/User/MailBox/FolderList.js b/dev/View/User/MailBox/FolderList.js index ea09669b0..2a62808fb 100644 --- a/dev/View/User/MailBox/FolderList.js +++ b/dev/View/User/MailBox/FolderList.js @@ -42,7 +42,7 @@ export class MailFolderList extends AbstractViewLeft { addComputablesTo(this, { folderListFocused: () => Scope.FolderList === AppUserStore.focusedState(), - folderListVisible: () => FolderUserStore.folderList().filter(v => !v.hidden()) + folderListVisible: () => FolderUserStore.folderList().filter(v => !(v.hidden() || v.kolab())) }); } diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Folder.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Folder.php index a3d394d42..dfff58aef 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Folder.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Folder.php @@ -171,8 +171,7 @@ class Folder implements \JsonSerializable public function IsSelectable() : bool { - $type = $this->getKolabFolderType(); - return $this->bExists && $this->oImapFolder->IsSelectable() && (!$type || 0 === \strpos($type, 'mail.')); + return $this->bExists && $this->oImapFolder->IsSelectable(); } /** @@ -234,7 +233,8 @@ class Folder implements \JsonSerializable /* // TODO: Kolab - switch ($this->getKolabFolderType()) { + $type = $this->GetMetadata(MetadataKeys::KOLAB_CTYPE) ?: $this->GetMetadata(MetadataKeys::KOLAB_CTYPE_SHARED); + switch (($type && 0 !== \strpos($type, 'mail.')) ? $type : null) { case 'event': return \MailSo\Imap\Enumerations\FolderType::CALENDAR; @@ -291,9 +291,4 @@ class Folder implements \JsonSerializable 'Metadata' => $this->oImapFolder->Metadata() ); } - - protected function getKolabFolderType() : ?string - { - return $this->GetMetadata(MetadataKeys::KOLAB_CTYPE) ?: $this->GetMetadata(MetadataKeys::KOLAB_CTYPE_SHARED); - } }