mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Bugfix: some folders were invisible while they should be visible
It all came down to a very complex subscribe system. I changed that in a "is visible for whatever reason" system.
This commit is contained in:
parent
5264cd8225
commit
2cf2b1ee75
3 changed files with 38 additions and 35 deletions
|
|
@ -225,7 +225,7 @@ export class FolderModel extends AbstractModel {
|
||||||
|
|
||||||
kolabType: null,
|
kolabType: null,
|
||||||
|
|
||||||
collapsedPrivate: true
|
collapsed: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this.addSubscribables({
|
this.addSubscribables({
|
||||||
|
|
@ -281,29 +281,45 @@ export class FolderModel extends AbstractModel {
|
||||||
isInbox: () => FolderType.Inbox === folder.type(),
|
isInbox: () => FolderType.Inbox === folder.type(),
|
||||||
|
|
||||||
isFlagged: () => FolderUserStore.currentFolder() === folder
|
isFlagged: () => FolderUserStore.currentFolder() === folder
|
||||||
&& MessageUserStore.listSearch().trim().includes('is:flagged'),
|
&& MessageUserStore.listSearch().includes('flagged'),
|
||||||
|
|
||||||
hasSubscribedSubfolders:
|
hasVisibleSubfolders: () => !!folder.subFolders().find(folder => folder.visible()),
|
||||||
() => !!folder.subFolders().find(
|
|
||||||
|
hasSubscriptions: () => folder.subscribed() | !!folder.subFolders().find(
|
||||||
oFolder => {
|
oFolder => {
|
||||||
const subscribed = oFolder.hasSubscriptions();
|
const subscribed = oFolder.hasSubscriptions();
|
||||||
return !oFolder.isSystemFolder() && subscribed;
|
return !oFolder.isSystemFolder() && subscribed;
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
||||||
hasSubscriptions: () => folder.subscribed() | folder.hasSubscribedSubfolders(),
|
|
||||||
|
|
||||||
canBeEdited: () => FolderType.User === folder.type() && folder.exists/* && folder.selectable()*/,
|
canBeEdited: () => FolderType.User === folder.type() && folder.exists/* && folder.selectable()*/,
|
||||||
|
|
||||||
visible: () => folder.hasSubscriptions() | !SettingsUserStore.hideUnsubscribed(),
|
|
||||||
|
|
||||||
isSystemFolder: () => FolderType.User !== folder.type() | !!folder.kolabType(),
|
isSystemFolder: () => FolderType.User !== folder.type() | !!folder.kolabType(),
|
||||||
|
|
||||||
hidden: () => {
|
canBeSelected: () => folder.selectable() && !folder.isSystemFolder(),
|
||||||
let hasSubFolders = folder.hasSubscribedSubfolders();
|
|
||||||
return (folder.isSystemFolder() | !folder.selectable()) && !hasSubFolders;
|
canBeDeleted: () => folder.canBeSelected() && folder.exists,
|
||||||
|
|
||||||
|
canBeSubscribed: () => folder.selectable()
|
||||||
|
&& !(folder.isSystemFolder() | !SettingsUserStore.hideUnsubscribed()),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Folder is visible when:
|
||||||
|
* - hasVisibleSubfolders()
|
||||||
|
* Or when all below conditions are true:
|
||||||
|
* - selectable()
|
||||||
|
* - subscribed() OR hideUnsubscribed = false
|
||||||
|
* - FolderType.User
|
||||||
|
* - not kolabType()
|
||||||
|
*/
|
||||||
|
visible: () => {
|
||||||
|
const selectable = folder.canBeSelected(),
|
||||||
|
visible = (folder.subscribed() | !SettingsUserStore.hideUnsubscribed()) && selectable;
|
||||||
|
return folder.hasVisibleSubfolders() | visible;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hidden: () => !folder.selectable() && (folder.isSystemFolder() | !folder.hasVisibleSubfolders()),
|
||||||
|
|
||||||
printableUnreadCount: () => {
|
printableUnreadCount: () => {
|
||||||
const count = folder.messageCountAll(),
|
const count = folder.messageCountAll(),
|
||||||
unread = folder.messageCountUnread(),
|
unread = folder.messageCountUnread(),
|
||||||
|
|
@ -326,13 +342,6 @@ export class FolderModel extends AbstractModel {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
canBeDeleted: () => !(folder.isSystemFolder() | !folder.selectable()),
|
|
||||||
|
|
||||||
canBeSubscribed: () => Settings.app('useImapSubscribe')
|
|
||||||
&& !(folder.isSystemFolder() | !SettingsUserStore.hideUnsubscribed() | !folder.selectable()),
|
|
||||||
|
|
||||||
canBeSelected: () => !(folder.isSystemFolder() | !folder.selectable() | folder.kolabType()),
|
|
||||||
|
|
||||||
localName: () => {
|
localName: () => {
|
||||||
let name = folder.name();
|
let name = folder.name();
|
||||||
if (folder.isSystemFolder()) {
|
if (folder.isSystemFolder()) {
|
||||||
|
|
@ -353,16 +362,11 @@ export class FolderModel extends AbstractModel {
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
|
|
||||||
collapsed: {
|
|
||||||
read: () => !folder.hidden() && folder.collapsedPrivate(),
|
|
||||||
write: value => folder.collapsedPrivate(value)
|
|
||||||
},
|
|
||||||
|
|
||||||
hasUnreadMessages: () => 0 < folder.messageCountUnread() && folder.printableUnreadCount(),
|
hasUnreadMessages: () => 0 < folder.messageCountUnread() && folder.printableUnreadCount(),
|
||||||
|
|
||||||
hasSubscribedUnreadMessagesSubfolders: () =>
|
hasSubscribedUnreadMessagesSubfolders: () =>
|
||||||
!!folder.subFolders().find(
|
!!folder.subFolders().find(
|
||||||
folder => folder.hasUnreadMessages() || folder.hasSubscribedUnreadMessagesSubfolders()
|
folder => folder.hasUnreadMessages() | folder.hasSubscribedUnreadMessagesSubfolders()
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -385,7 +389,7 @@ export class FolderModel extends AbstractModel {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
collapsedCss() {
|
collapsedCss() {
|
||||||
return 'e-collapsed-sign ' + (this.hasSubscribedSubfolders()
|
return 'e-collapsed-sign ' + (this.hasVisibleSubfolders()
|
||||||
? (this.collapsed() ? 'icon-right-mini' : 'icon-down-mini')
|
? (this.collapsed() ? 'icon-right-mini' : 'icon-down-mini')
|
||||||
: 'icon-none'
|
: 'icon-none'
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import ko from 'ko';
|
||||||
|
|
||||||
import { Layout, EditorDefaultType } from 'Common/EnumsUser';
|
import { Layout, EditorDefaultType } from 'Common/EnumsUser';
|
||||||
import { pInt, addObservablesTo } from 'Common/Utils';
|
import { pInt, addObservablesTo } from 'Common/Utils';
|
||||||
import { $htmlCL, SettingsGet } from 'Common/Globals';
|
import { $htmlCL, Settings, SettingsGet } from 'Common/Globals';
|
||||||
import { ThemeStore } from 'Stores/Theme';
|
import { ThemeStore } from 'Stores/Theme';
|
||||||
|
|
||||||
export const SettingsUserStore = new class {
|
export const SettingsUserStore = new class {
|
||||||
|
|
@ -31,7 +31,7 @@ export const SettingsUserStore = new class {
|
||||||
allowDraftAutosave: !!SettingsGet('AllowDraftAutosave'),
|
allowDraftAutosave: !!SettingsGet('AllowDraftAutosave'),
|
||||||
useThreads: !!SettingsGet('UseThreads'),
|
useThreads: !!SettingsGet('UseThreads'),
|
||||||
replySameFolder: !!SettingsGet('ReplySameFolder'),
|
replySameFolder: !!SettingsGet('ReplySameFolder'),
|
||||||
hideUnsubscribed: !!SettingsGet('HideUnsubscribed'),
|
hideUnsubscribed: Settings.app('useImapSubscribe') && SettingsGet('HideUnsubscribed'),
|
||||||
autoLogout: pInt(SettingsGet('AutoLogout'))
|
autoLogout: pInt(SettingsGet('AutoLogout'))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,15 +44,14 @@ export class MailFolderList extends AbstractViewLeft {
|
||||||
|
|
||||||
folderListVisible: () => {
|
folderListVisible: () => {
|
||||||
let multiple = false,
|
let multiple = false,
|
||||||
inbox, subscribed, hasSub,
|
inbox, visible,
|
||||||
result = FolderUserStore.folderList().filter(folder => {
|
result = FolderUserStore.folderList().filter(folder => {
|
||||||
if (folder.isInbox()) {
|
if (folder.isInbox()) {
|
||||||
inbox = folder;
|
inbox = folder;
|
||||||
}
|
}
|
||||||
subscribed = folder.subscribed();
|
visible = folder.visible();
|
||||||
hasSub = folder.hasSubscribedSubfolders();
|
multiple |= visible && !folder.isInbox();
|
||||||
multiple |= (!folder.isSystemFolder() || (hasSub && !folder.isInbox())) && (subscribed || hasSub)
|
return visible;
|
||||||
return !(folder.hidden() | folder.kolabType());
|
|
||||||
});
|
});
|
||||||
if (inbox && !multiple) {
|
if (inbox && !multiple) {
|
||||||
inbox.collapsedPrivate(false);
|
inbox.collapsedPrivate(false);
|
||||||
|
|
@ -109,7 +108,7 @@ export class MailFolderList extends AbstractViewLeft {
|
||||||
|
|
||||||
rl.route.setHash(
|
rl.route.setHash(
|
||||||
mailBox(folder.fullNameHash, 1,
|
mailBox(folder.fullNameHash, 1,
|
||||||
(event.target.matches('.flag-icon') && !folder.isFlagged()) ? 'is:flagged' : ''
|
(event.target.matches('.flag-icon') && !folder.isFlagged()) ? 'flagged' : ''
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue