From 3b35df413775d67f337fb80c912aab7f53aa785a Mon Sep 17 00:00:00 2001 From: Eduard Kuzmenko Date: Fri, 11 Feb 2022 23:29:25 +0400 Subject: [PATCH] Fix suggesting mentions --- src/components/chat/topbar.ts | 2 +- src/lib/appManagers/appProfileManager.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/chat/topbar.ts b/src/components/chat/topbar.ts index 2ddd781a..9a986857 100644 --- a/src/components/chat/topbar.ts +++ b/src/components/chat/topbar.ts @@ -334,7 +334,7 @@ export default class ChatTopbar { text: 'ViewDiscussion', onClick: () => { const middleware = this.chat.bubbles.getMiddleware(); - this.appProfileManager.getChannelFull(this.peerId.toChatId()).then(channelFull => { + Promise.resolve(this.appProfileManager.getChannelFull(this.peerId.toChatId())).then(channelFull => { if(middleware() && channelFull.linked_chat_id) { this.chat.appImManager.setInnerPeer({ peerId: channelFull.linked_chat_id.toPeerId(true) diff --git a/src/lib/appManagers/appProfileManager.ts b/src/lib/appManagers/appProfileManager.ts index b8a2bc06..affd19fb 100644 --- a/src/lib/appManagers/appProfileManager.ts +++ b/src/lib/appManagers/appProfileManager.ts @@ -373,9 +373,9 @@ export class AppProfileManager { }); } - public getChannelFull(id: ChatId, override?: true): Promise { + public getChannelFull(id: ChatId, override?: true) { if(this.chatsFull[id] !== undefined && !override) { - return Promise.resolve(this.chatsFull[id] as ChatFull.channelFull); + return this.chatsFull[id] as ChatFull.channelFull; } return apiManager.invokeApiSingleProcess({ @@ -457,8 +457,8 @@ export class AppProfileManager { return cP.participants.map(p => appChatsManager.getParticipantPeerId(p)); }); } else if(chatId) { - promise = (this.getChatFull(chatId) as Promise).then(chatFull => { - return (chatFull.participants as ChatParticipants.chatParticipants).participants.map(p => p.user_id.toPeerId()); + promise = Promise.resolve(this.getChatFull(chatId)).then(chatFull => { + return ((chatFull as ChatFull.chatFull).participants as ChatParticipants.chatParticipants).participants.map(p => p.user_id.toPeerId()); }); } else { promise = Promise.resolve([]);