mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-02 09:37:47 +01:00
Message List: Fix animation in small chats
This commit is contained in:
parent
deee9cffc8
commit
7681f5998c
@ -32,7 +32,9 @@ import {
|
||||
selectScheduledMessages,
|
||||
isMessageInCurrentMessageList,
|
||||
selectScheduledIds,
|
||||
selectCurrentMessageList, selectRealLastReadId, selectViewportIds,
|
||||
selectCurrentMessageList,
|
||||
selectViewportIds,
|
||||
selectFirstUnreadId,
|
||||
} from '../../selectors';
|
||||
import { getMessageContent, isChatPrivate, isMessageLocal } from '../../helpers';
|
||||
|
||||
@ -427,12 +429,12 @@ function updateListedAndViewportIds(global: GlobalState, message: ApiMessage) {
|
||||
global = updateListedIds(global, chatId, MAIN_THREAD_ID, [id]);
|
||||
|
||||
if (selectIsViewportNewest(global, chatId, MAIN_THREAD_ID)) {
|
||||
// Always keep at least one read 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 || newViewportIds!.includes(lastReadId)) {
|
||||
if (!firstUnreadId || newViewportIds!.includes(firstUnreadId)) {
|
||||
global = newGlobal;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user