mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Improved Kolab folders visibility
This commit is contained in:
parent
fa6590b3ab
commit
ef9d1ed220
4 changed files with 25 additions and 11 deletions
|
|
@ -14,6 +14,20 @@ export const FolderType = {
|
||||||
NotSpam: 80
|
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}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { AbstractCollectionModel } from 'Model/AbstractCollection';
|
||||||
|
|
||||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||||
import { isArray, pInt } from 'Common/Utils';
|
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 * as Cache from 'Common/Cache';
|
||||||
import { Settings, SettingsGet } from 'Common/Globals';
|
import { Settings, SettingsGet } from 'Common/Globals';
|
||||||
|
|
||||||
|
|
@ -210,6 +210,8 @@ export class FolderModel extends AbstractModel {
|
||||||
privateMessageCountAll: 0,
|
privateMessageCountAll: 0,
|
||||||
privateMessageCountUnread: 0,
|
privateMessageCountUnread: 0,
|
||||||
|
|
||||||
|
kolab: null,
|
||||||
|
|
||||||
collapsedPrivate: true
|
collapsedPrivate: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -227,6 +229,9 @@ export class FolderModel extends AbstractModel {
|
||||||
if (folder) {
|
if (folder) {
|
||||||
folder.deep = json.FullNameRaw.split(folder.delimiter).length - 1;
|
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({
|
folder.messageCountAll = ko.computed({
|
||||||
read: folder.privateMessageCountAll,
|
read: folder.privateMessageCountAll,
|
||||||
write: (iValue) => {
|
write: (iValue) => {
|
||||||
|
|
@ -306,7 +311,7 @@ export class FolderModel extends AbstractModel {
|
||||||
canBeSubscribed: () => Settings.app('useImapSubscribe')
|
canBeSubscribed: () => Settings.app('useImapSubscribe')
|
||||||
&& !(folder.isSystemFolder() | !SettingsUserStore.hideUnsubscribed() | !folder.selectable()),
|
&& !(folder.isSystemFolder() | !SettingsUserStore.hideUnsubscribed() | !folder.selectable()),
|
||||||
|
|
||||||
canBeSelected: () => !(folder.isSystemFolder() | !folder.selectable()),
|
canBeSelected: () => !(folder.isSystemFolder() | !folder.selectable() | folder.kolab()),
|
||||||
|
|
||||||
localName: () => {
|
localName: () => {
|
||||||
let name = folder.name();
|
let name = folder.name();
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ export class MailFolderList extends AbstractViewLeft {
|
||||||
addComputablesTo(this, {
|
addComputablesTo(this, {
|
||||||
folderListFocused: () => Scope.FolderList === AppUserStore.focusedState(),
|
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
|
public function IsSelectable() : bool
|
||||||
{
|
{
|
||||||
$type = $this->getKolabFolderType();
|
return $this->bExists && $this->oImapFolder->IsSelectable();
|
||||||
return $this->bExists && $this->oImapFolder->IsSelectable() && (!$type || 0 === \strpos($type, 'mail.'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -234,7 +233,8 @@ class Folder implements \JsonSerializable
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// TODO: Kolab
|
// 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':
|
case 'event':
|
||||||
return \MailSo\Imap\Enumerations\FolderType::CALENDAR;
|
return \MailSo\Imap\Enumerations\FolderType::CALENDAR;
|
||||||
|
|
@ -291,9 +291,4 @@ class Folder implements \JsonSerializable
|
||||||
'Metadata' => $this->oImapFolder->Metadata()
|
'Metadata' => $this->oImapFolder->Metadata()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getKolabFolderType() : ?string
|
|
||||||
{
|
|
||||||
return $this->GetMetadata(MetadataKeys::KOLAB_CTYPE) ?: $this->GetMetadata(MetadataKeys::KOLAB_CTYPE_SHARED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue