Message List: Another attempt to fix marking all messages read
This commit is contained in:
parent
fbcf22bfe6
commit
66d7cfe71b
@ -35,6 +35,7 @@ import {
|
||||
selectCurrentMessageList,
|
||||
selectViewportIds,
|
||||
selectFirstUnreadId,
|
||||
selectRealLastReadId,
|
||||
} from '../../selectors';
|
||||
import { getMessageContent, isChatPrivate, isMessageLocal } from '../../helpers';
|
||||
|
||||
@ -429,12 +430,13 @@ 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 uread message in the viewport list
|
||||
// Always keep the first unread message in the viewport list
|
||||
const lastReadId = selectRealLastReadId(global, chatId, MAIN_THREAD_ID);
|
||||
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 (!firstUnreadId || newViewportIds!.includes(firstUnreadId)) {
|
||||
if (!lastReadId || (firstUnreadId && newViewportIds!.includes(firstUnreadId))) {
|
||||
global = newGlobal;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user