diff --git a/src/global/selectors/messages.ts b/src/global/selectors/messages.ts index 30597ad75..22d890c91 100644 --- a/src/global/selectors/messages.ts +++ b/src/global/selectors/messages.ts @@ -755,16 +755,11 @@ export function selectRealLastReadId(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) {