From 60d924e5a0071f6a9f0b19e0f6ead59e6f3667e0 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Wed, 14 Jun 2023 13:25:41 +0200 Subject: [PATCH] Message List: Fix incorrect position on opening (#3283) --- src/global/selectors/messages.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/global/selectors/messages.ts b/src/global/selectors/messages.ts index 30597ad75..22d890c91 100644 --- a/src/global/selectors/messages.ts +++ b/src/global/selectors/messages.ts @@ -755,16 +755,11 @@ export function selectRealLastReadId(global: T, chatId: s return undefined; } - if (!chat.lastMessage) { + if (!chat.lastMessage || chat.unreadCount) { return chat.lastReadInboxMessageId; } - if (isMessageLocal(chat.lastMessage)) { - return chat.lastMessage.id; - } - - // Some previously read messages may be deleted - return Math.min(chat.lastMessage.id, chat.lastReadInboxMessageId); + return chat.lastMessage.id; } else { const threadInfo = selectThreadInfo(global, chatId, threadId); if (!threadInfo) {