From b39b3de86b12cbdbea6c81420d1db9c8db76c052 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Wed, 5 Jul 2023 13:15:25 +0200 Subject: [PATCH] Channel: Fix opening comments (#3454) --- src/global/actions/api/messages.ts | 2 +- src/global/actions/api/sync.ts | 2 +- src/global/reducers/messages.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/global/actions/api/messages.ts b/src/global/actions/api/messages.ts index 7185edbe4..98324bd41 100644 --- a/src/global/actions/api/messages.ts +++ b/src/global/actions/api/messages.ts @@ -1037,7 +1037,7 @@ async function loadViewportMessages( global = addUsers(global, buildCollectionByKey(users, 'id')); global = addChats(global, buildCollectionByKey(chats, 'id')); - global = updateThreadInfos(global, chatId, repliesThreadInfos); + global = updateThreadInfos(global, repliesThreadInfos); let listedIds = selectListedIds(global, chatId, threadId); const outlyingList = offsetId ? selectOutlyingListByMessageId(global, chatId, threadId, offsetId) : undefined; diff --git a/src/global/actions/api/sync.ts b/src/global/actions/api/sync.ts index b7d1c1ddc..cdd632b17 100644 --- a/src/global/actions/api/sync.ts +++ b/src/global/actions/api/sync.ts @@ -175,7 +175,7 @@ async function loadAndReplaceMessages(global: T, actions: global = updateChats(global, buildCollectionByKey(result.chats, 'id')); global = updateUsers(global, buildCollectionByKey(result.users, 'id')); if (result.repliesThreadInfos.length) { - global = updateThreadInfos(global, currentChatId, result.repliesThreadInfos); + global = updateThreadInfos(global, result.repliesThreadInfos); } areMessagesLoaded = true; diff --git a/src/global/reducers/messages.ts b/src/global/reducers/messages.ts index d823fc2c8..d3ad58fa7 100644 --- a/src/global/reducers/messages.ts +++ b/src/global/reducers/messages.ts @@ -490,10 +490,10 @@ export function updateThreadInfo( } export function updateThreadInfos( - global: T, chatId: string, updates: Partial[], + global: T, updates: Partial[], ): T { updates.forEach((update) => { - global = updateThreadInfo(global, chatId, update.threadId!, update); + global = updateThreadInfo(global, update.chatId!, update.threadId!, update); }); return global;