Message List: Fix incorrect position on opening (#3283)

This commit is contained in:
Alexander Zinchuk 2023-06-14 13:25:41 +02:00
parent e880d83377
commit 60d924e5a0

View File

@ -755,16 +755,11 @@ export function selectRealLastReadId<T extends GlobalState>(global: T, chatId: s
return undefined;
}
if (!chat.lastMessage) {
if (!chat.lastMessage || chat.unreadCount) {
return chat.lastReadInboxMessageId;
}
if (isMessageLocal(chat.lastMessage)) {
return chat.lastMessage.id;
}
// Some previously read messages may be deleted
return Math.min(chat.lastMessage.id, chat.lastReadInboxMessageId);
return chat.lastMessage.id;
} else {
const threadInfo = selectThreadInfo(global, chatId, threadId);
if (!threadInfo) {