From f4ad77576b8f1012b05f22d3464f3af06d77f109 Mon Sep 17 00:00:00 2001 From: Eduard Kuzmenko Date: Mon, 9 Nov 2020 20:25:37 +0300 Subject: [PATCH] Fix own peer color Fix load state if too few dialogs Fix opening chat with first album --- src/lib/appManagers/appDialogsManager.ts | 17 +++++++---------- src/lib/appManagers/appImManager.ts | 1 + 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/lib/appManagers/appDialogsManager.ts b/src/lib/appManagers/appDialogsManager.ts index 373d1617..871482ae 100644 --- a/src/lib/appManagers/appDialogsManager.ts +++ b/src/lib/appManagers/appDialogsManager.ts @@ -329,19 +329,16 @@ export class AppDialogsManager { //selectTab(0); (this.folders.menu.firstElementChild.firstElementChild as HTMLElement).click(); - - /* false && */appStateManager.getState().then(() => { - return appMessagesManager.filtersStorage.getDialogFilters(); - }).then(filters => { - for(const filterID in filters) { - this.addFilter(filters[filterID]); - } + appStateManager.getState().then((state) => { + const getFiltersPromise = !state.filters || Object.keys(state.filters).length ? appMessagesManager.filtersStorage.getDialogFilters() : Promise.resolve({}); + getFiltersPromise.then((filters) => { + for(const filterID in filters) { + this.addFilter(filters[filterID]); + } + }); return this.loadDialogs(); }).then(result => { - //this.setPinnedDelimiter(); - //appSidebarLeft.onChatsScroll(); - //this.loadDialogs(1); appMessagesManager.getConversationsAll('', 1).then(() => { this.accumulateArchivedUnread(); }); diff --git a/src/lib/appManagers/appImManager.ts b/src/lib/appManagers/appImManager.ts index e9159e44..bec758dd 100644 --- a/src/lib/appManagers/appImManager.ts +++ b/src/lib/appManagers/appImManager.ts @@ -2551,6 +2551,7 @@ export class AppImManager { for(let i = additionMsgIDs.length - 1; i >= 0; --i) { const message = appMessagesManager.getMessage(additionMsgIDs[i]); if(message.grouped_id) additionMsgIDs.splice(i, 1); + else break; } maxID = additionMsgIDs[additionMsgIDs.length - 1] || maxID;