mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-06-28 06:46:27 +00:00
Improved Kolab folders visibility
This commit is contained in:
@@ -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}
|
||||
*/
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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()))
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user