Forward Modal: Show saved messages chat (#4897)

This commit is contained in:
Alexander Zinchuk 2024-08-29 15:52:46 +02:00
parent 4d62237761
commit 53ef4deaa3
2 changed files with 11 additions and 8 deletions

View File

@ -83,10 +83,13 @@ const RecipientPicker: FC<OwnProps & StateProps> = ({
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]);

View File

@ -97,19 +97,19 @@ export function selectIsTrustedBot<T extends GlobalState>(global: T, botId: stri
}
export function selectChatType<T extends GlobalState>(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';
}