Forward Modal: Hotfix for duplicate Saved Messages in Forward Modal (#4917)
This commit is contained in:
parent
0685adbfe8
commit
d51fc2a3a2
@ -83,13 +83,16 @@ const RecipientPicker: FC<OwnProps & StateProps> = ({
|
||||
return chat && getCanPostInChat(chat, MAIN_THREAD_ID, undefined, chatFullInfoById[id]);
|
||||
});
|
||||
|
||||
const sorted = [
|
||||
...(currentUserId ? [currentUserId] : []),
|
||||
...sortChatIds(unique([
|
||||
const sorted = sortChatIds(
|
||||
unique([
|
||||
...(currentUserId ? [currentUserId] : []),
|
||||
...filterChatsByName(lang, chatIds, chatsById, search, currentUserId),
|
||||
...(contactIds && filter.includes('users') ? filterUsersByName(contactIds, usersById, search) : []),
|
||||
]), undefined, priorityIds),
|
||||
];
|
||||
]),
|
||||
undefined,
|
||||
priorityIds,
|
||||
currentUserId,
|
||||
);
|
||||
|
||||
return filterChatIdsByType(global, sorted, filter);
|
||||
}, [pinnedIds, currentUserId, activeListIds, search, archivedListIds, lang, contactIds, filter, isOpen]);
|
||||
|
||||
@ -10,10 +10,16 @@ export default function sortChatIds(
|
||||
chatIds: string[],
|
||||
shouldPrioritizeVerified = false,
|
||||
priorityIds?: string[],
|
||||
currentUserId?: string,
|
||||
) {
|
||||
// Avoid calling sort on every global change
|
||||
const global = getGlobal();
|
||||
|
||||
return orderBy(chatIds, (id) => {
|
||||
if (id === currentUserId) {
|
||||
return Infinity;
|
||||
}
|
||||
|
||||
const chat = selectChat(global, id);
|
||||
if (!chat) {
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user