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]);
|
return chat && getCanPostInChat(chat, MAIN_THREAD_ID, undefined, chatFullInfoById[id]);
|
||||||
});
|
});
|
||||||
|
|
||||||
const sorted = [
|
const sorted = sortChatIds(
|
||||||
...(currentUserId ? [currentUserId] : []),
|
unique([
|
||||||
...sortChatIds(unique([
|
...(currentUserId ? [currentUserId] : []),
|
||||||
...filterChatsByName(lang, chatIds, chatsById, search, currentUserId),
|
...filterChatsByName(lang, chatIds, chatsById, search, currentUserId),
|
||||||
...(contactIds && filter.includes('users') ? filterUsersByName(contactIds, usersById, search) : []),
|
...(contactIds && filter.includes('users') ? filterUsersByName(contactIds, usersById, search) : []),
|
||||||
]), undefined, priorityIds),
|
]),
|
||||||
];
|
undefined,
|
||||||
|
priorityIds,
|
||||||
|
currentUserId,
|
||||||
|
);
|
||||||
|
|
||||||
return filterChatIdsByType(global, sorted, filter);
|
return filterChatIdsByType(global, sorted, filter);
|
||||||
}, [pinnedIds, currentUserId, activeListIds, search, archivedListIds, lang, contactIds, filter, isOpen]);
|
}, [pinnedIds, currentUserId, activeListIds, search, archivedListIds, lang, contactIds, filter, isOpen]);
|
||||||
|
|||||||
@ -10,10 +10,16 @@ export default function sortChatIds(
|
|||||||
chatIds: string[],
|
chatIds: string[],
|
||||||
shouldPrioritizeVerified = false,
|
shouldPrioritizeVerified = false,
|
||||||
priorityIds?: string[],
|
priorityIds?: string[],
|
||||||
|
currentUserId?: string,
|
||||||
) {
|
) {
|
||||||
// Avoid calling sort on every global change
|
// Avoid calling sort on every global change
|
||||||
const global = getGlobal();
|
const global = getGlobal();
|
||||||
|
|
||||||
return orderBy(chatIds, (id) => {
|
return orderBy(chatIds, (id) => {
|
||||||
|
if (id === currentUserId) {
|
||||||
|
return Infinity;
|
||||||
|
}
|
||||||
|
|
||||||
const chat = selectChat(global, id);
|
const chat = selectChat(global, id);
|
||||||
if (!chat) {
|
if (!chat) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user