From af9df0b22c633a8bfd8aa01730fd94e7f537da3f Mon Sep 17 00:00:00 2001 From: morethanwords Date: Tue, 1 Jun 2021 19:05:54 +0300 Subject: [PATCH] Fix new folder orderIndex --- src/components/sidebarLeft/tabs/chatFolders.ts | 4 +++- src/lib/storages/filters.ts | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/sidebarLeft/tabs/chatFolders.ts b/src/components/sidebarLeft/tabs/chatFolders.ts index ea5703aa..3c0c45a0 100644 --- a/src/components/sidebarLeft/tabs/chatFolders.ts +++ b/src/components/sidebarLeft/tabs/chatFolders.ts @@ -62,7 +62,9 @@ export default class AppChatFoldersTab extends SliderSuperTab { if(k) { d.push(i18n(k)); } - } else { + } + + if(!d.length) { const folder = appMessagesManager.dialogsStorage.getFolder(filter.id); let chats = 0, channels = 0, groups = 0; for(const dialog of folder) { diff --git a/src/lib/storages/filters.ts b/src/lib/storages/filters.ts index 48e84c45..130c9760 100644 --- a/src/lib/storages/filters.ts +++ b/src/lib/storages/filters.ts @@ -43,6 +43,13 @@ export default class FiltersStorage { this.appStateManager.getState().then((state) => { this.filters = state.filters; + + for(const filterId in this.filters) { + const filter = this.filters[filterId]; + if(filter.hasOwnProperty('orderIndex') && filter.orderIndex >= this.orderIndex) { + this.orderIndex = filter.orderIndex + 1; + } + } }); rootScope.addMultipleEventsListeners({