From 53ef4deaa30c1750fd15294e2c9fd6ef9f2f510a Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Thu, 29 Aug 2024 15:52:46 +0200 Subject: [PATCH] Forward Modal: Show saved messages chat (#4897) --- src/components/common/RecipientPicker.tsx | 11 +++++++---- src/global/selectors/chats.ts | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/components/common/RecipientPicker.tsx b/src/components/common/RecipientPicker.tsx index a4b033eba..5d41834f4 100644 --- a/src/components/common/RecipientPicker.tsx +++ b/src/components/common/RecipientPicker.tsx @@ -83,10 +83,13 @@ const RecipientPicker: FC = ({ return chat && getCanPostInChat(chat, MAIN_THREAD_ID, undefined, chatFullInfoById[id]); }); - const sorted = sortChatIds(unique([ - ...filterChatsByName(lang, chatIds, chatsById, search, currentUserId), - ...(contactIds && filter.includes('users') ? filterUsersByName(contactIds, usersById, search) : []), - ]), undefined, priorityIds); + const sorted = [ + ...(currentUserId ? [currentUserId] : []), + ...sortChatIds(unique([ + ...filterChatsByName(lang, chatIds, chatsById, search, currentUserId), + ...(contactIds && filter.includes('users') ? filterUsersByName(contactIds, usersById, search) : []), + ]), undefined, priorityIds), + ]; return filterChatIdsByType(global, sorted, filter); }, [pinnedIds, currentUserId, activeListIds, search, archivedListIds, lang, contactIds, filter, isOpen]); diff --git a/src/global/selectors/chats.ts b/src/global/selectors/chats.ts index ed0d107fa..dd24defeb 100644 --- a/src/global/selectors/chats.ts +++ b/src/global/selectors/chats.ts @@ -97,19 +97,19 @@ export function selectIsTrustedBot(global: T, botId: stri } export function selectChatType(global: T, chatId: string) : ApiChatType | undefined { - const chat = selectChat(global, chatId); - if (!chat) return undefined; - const bot = selectBot(global, chatId); if (bot) { return 'bots'; } - const user = selectChatUser(global, chat); + const user = selectUser(global, chatId); if (user) { return 'users'; } + const chat = selectChat(global, chatId); + if (!chat) return undefined; + if (isChatChannel(chat)) { return 'channels'; }