Message List: Another (2) attempt to fix marking all messages read

This commit is contained in:
Alexander Zinchuk 2021-06-15 13:21:39 +03:00
parent 85234ae8d7
commit 526b00eda4

View File

@ -36,6 +36,7 @@ import {
selectViewportIds,
selectFirstUnreadId,
selectRealLastReadId,
selectChat,
} from '../../selectors';
import { getMessageContent, isChatPrivate, isMessageLocal } from '../../helpers';
@ -427,6 +428,12 @@ function updateWithLocalMedia(
function updateListedAndViewportIds(global: GlobalState, message: ApiMessage) {
const { id, chatId } = message;
const chat = selectChat(global, chatId);
const isUnreadChatNotLoaded = chat && chat.unreadCount && !selectListedIds(global, chatId, MAIN_THREAD_ID);
if (isUnreadChatNotLoaded) {
return global;
}
global = updateListedIds(global, chatId, MAIN_THREAD_ID, [id]);
if (selectIsViewportNewest(global, chatId, MAIN_THREAD_ID)) {