diff --git a/src/modules/selectors/messages.ts b/src/modules/selectors/messages.ts index 9271eac2e..fa9b5f338 100644 --- a/src/modules/selectors/messages.ts +++ b/src/modules/selectors/messages.ts @@ -596,13 +596,9 @@ export function selectFirstUnreadId(global: GlobalState, chatId: string, threadI : -1; function findAfterLastReadId(listIds: number[]) { - if (!lastReadId) { - return listIds[0]; - } - return listIds.find((id) => { return ( - id > lastReadId + (!lastReadId || id > lastReadId) && byId[id] && (!byId[id].isOutgoing || byId[id].isFromScheduled) && id > lastReadServiceNotificationId