From ef58550d6eecdd579545729d27c6981a2148d415 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Tue, 15 Jun 2021 13:35:46 +0300 Subject: [PATCH] Revert "Message List: Another attempt to fix marking all messages read" This reverts commit f2f7cc912f74f1312bb7c79866fea7dbf3f671e1. --- src/modules/actions/apiUpdaters/messages.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/modules/actions/apiUpdaters/messages.ts b/src/modules/actions/apiUpdaters/messages.ts index e87164902..bce96967f 100644 --- a/src/modules/actions/apiUpdaters/messages.ts +++ b/src/modules/actions/apiUpdaters/messages.ts @@ -35,7 +35,6 @@ import { selectCurrentMessageList, selectViewportIds, selectFirstUnreadId, - selectRealLastReadId, selectChat, } from '../../selectors'; import { getMessageContent, isChatPrivate, isMessageLocal } from '../../helpers'; @@ -437,13 +436,12 @@ function updateListedAndViewportIds(global: GlobalState, message: ApiMessage) { global = updateListedIds(global, chatId, MAIN_THREAD_ID, [id]); if (selectIsViewportNewest(global, chatId, MAIN_THREAD_ID)) { - // Always keep the first unread message in the viewport list - const lastReadId = selectRealLastReadId(global, chatId, MAIN_THREAD_ID); + // Always keep the first uread message in the viewport list const firstUnreadId = selectFirstUnreadId(global, chatId, MAIN_THREAD_ID); const newGlobal = addViewportId(global, chatId, MAIN_THREAD_ID, id); const newViewportIds = selectViewportIds(newGlobal, chatId, MAIN_THREAD_ID); - if (!lastReadId || (firstUnreadId && newViewportIds!.includes(firstUnreadId))) { + if (!firstUnreadId || newViewportIds!.includes(firstUnreadId)) { global = newGlobal; } }