Message List: Another (2) attempt to fix marking all messages read
This commit is contained in:
parent
85234ae8d7
commit
526b00eda4
@ -36,6 +36,7 @@ import {
|
|||||||
selectViewportIds,
|
selectViewportIds,
|
||||||
selectFirstUnreadId,
|
selectFirstUnreadId,
|
||||||
selectRealLastReadId,
|
selectRealLastReadId,
|
||||||
|
selectChat,
|
||||||
} from '../../selectors';
|
} from '../../selectors';
|
||||||
import { getMessageContent, isChatPrivate, isMessageLocal } from '../../helpers';
|
import { getMessageContent, isChatPrivate, isMessageLocal } from '../../helpers';
|
||||||
|
|
||||||
@ -427,6 +428,12 @@ function updateWithLocalMedia(
|
|||||||
function updateListedAndViewportIds(global: GlobalState, message: ApiMessage) {
|
function updateListedAndViewportIds(global: GlobalState, message: ApiMessage) {
|
||||||
const { id, chatId } = message;
|
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]);
|
global = updateListedIds(global, chatId, MAIN_THREAD_ID, [id]);
|
||||||
|
|
||||||
if (selectIsViewportNewest(global, chatId, MAIN_THREAD_ID)) {
|
if (selectIsViewportNewest(global, chatId, MAIN_THREAD_ID)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user