Cleanup folder handling a bit

This commit is contained in:
the-djmaze 2022-08-03 11:06:09 +02:00
parent 421efc62ad
commit 18dc2889ce
6 changed files with 10 additions and 20 deletions

View file

@ -1,5 +1,4 @@
import ko from 'ko';
import { koComputable } from 'External/ko';
import { Notification } from 'Common/Enums';
import { FolderMetadataKeys } from 'Common/EnumsUser';
@ -48,14 +47,7 @@ export class UserSettingsFolders /*extends AbstractViewSettings*/ {
this.folderListError = FolderUserStore.folderListError;
this.hideUnsubscribed = SettingsUserStore.hideUnsubscribed;
this.loading = koComputable(() => {
const loading = FolderUserStore.foldersLoading(),
creating = FolderUserStore.foldersCreating(),
deleting = FolderUserStore.foldersDeleting(),
renaming = FolderUserStore.foldersRenaming();
return loading || creating || deleting || renaming;
});
this.loading = FolderUserStore.foldersChanging;
this.folderForDeletion = folderForDeletion;

View file

@ -64,7 +64,7 @@ export const FolderUserStore = new class {
foldersChanging: () =>
self.foldersLoading() | self.foldersCreating() | self.foldersDeleting() | self.foldersRenaming(),
folderListSystemNames: () => {
systemFoldersNames: () => {
const list = [getFolderInboxName()],
others = [self.sentFolder(), self.draftsFolder(), self.spamFolder(), self.trashFolder(), self.archiveFolder()];
@ -74,8 +74,8 @@ export const FolderUserStore = new class {
return list;
},
folderListSystem: () =>
self.folderListSystemNames().map(name => getFolderFromCacheList(name)).filter(v => v)
systemFolders: () =>
self.systemFoldersNames().map(name => getFolderFromCacheList(name)).filter(v => v)
});
const

View file

@ -19,7 +19,7 @@ export class FolderSystemPopupView extends AbstractViewPopup {
this.folderSelectList = koComputable(() =>
folderListOptionsBuilder(
FolderUserStore.folderListSystemNames(),
FolderUserStore.systemFoldersNames(),
[
['', i18n('POPUPS_SYSTEM_FOLDERS/SELECT_CHOOSE_ONE')],
[UNUSED_OPTION_VALUE, i18n('POPUPS_SYSTEM_FOLDERS/SELECT_UNUSE_NAME')]

View file

@ -31,9 +31,7 @@ export class MailFolderList extends AbstractViewLeft {
this.composeInEdit = AppUserStore.composeInEdit;
this.folderList = FolderUserStore.folderList;
this.folderListSystem = FolderUserStore.folderListSystem;
this.foldersChanging = FolderUserStore.foldersChanging;
this.systemFolders = FolderUserStore.systemFolders;
this.moveAction = moveAction;

View file

@ -7,7 +7,7 @@
<a class="btn buttonContacts fontastic" data-bind="visible: allowContacts, click: contactsClick" data-i18n="[title]GLOBAL/CONTACTS">📇</a>
</div>
<div class="b-content">
<ul class="b-folders-system" data-bind="foreach: folderListSystem">
<ul class="b-folders-system" data-bind="foreach: systemFolders">
<li>
<a data-bind="dropmessages: $data,
css: { 'selected': selected, 'selectable': selectable, 'anim-action-class': actionBlink, 'is-flagged': isFlagged },
@ -32,7 +32,7 @@
</div>
<div class="btn-group hide-on-panel-disabled">
<a class="btn" data-bind="click: createFolder" data-i18n="[title]POPUPS_CREATE_FOLDER/TITLE_CREATE_FOLDER">
<i data-bind="css: {'icon-folder-add': !foldersChanging(), 'icon-spinner': foldersChanging()}"></i>
<i class="icon-folder-add"></i>
</a>
<a class="btn fontastic" data-bind="click: configureFolders"></a>
</div>

View file

@ -68,10 +68,10 @@
content: "\e033";
}
.icon-file-text::before {
content: "\e034";
content: "\e034"; /* 🖹 | 🖺 */
}
.icon-file-image::before {
content: "\e036";
content: "\e036"; /* 🖻 */
}
.icon-file-certificate::before {
content: "\e038";