diff --git a/src/api/gramjs/apiBuilders/messages.ts b/src/api/gramjs/apiBuilders/messages.ts index 1862c267b..334b56d0a 100644 --- a/src/api/gramjs/apiBuilders/messages.ts +++ b/src/api/gramjs/apiBuilders/messages.ts @@ -899,6 +899,7 @@ function buildAction( let score: number | undefined; let months: number | undefined; let topicEmojiIconId: string | undefined; + let isTopicAction: boolean | undefined; const targetUserIds = 'users' in action ? action.users && action.users.map((id) => buildApiPeerId(id, 'user')) @@ -1063,6 +1064,7 @@ function buildAction( } else { text = 'ChatList.UnsupportedMessage'; } + isTopicAction = true; } else if (action instanceof GramJs.MessageActionAttachMenuBotAllowed) { text = 'ActionAttachMenuBotAllowed'; } else if (action instanceof GramJs.MessageActionSuggestProfilePhoto) { @@ -1097,6 +1099,7 @@ function buildAction( score, months, topicEmojiIconId, + isTopicAction, }; } diff --git a/src/api/types/messages.ts b/src/api/types/messages.ts index f9aa08ed3..f93c16e7b 100644 --- a/src/api/types/messages.ts +++ b/src/api/types/messages.ts @@ -273,6 +273,7 @@ export interface ApiAction { score?: number; months?: number; topicEmojiIconId?: string; + isTopicAction?: boolean; } export interface ApiWebPage { diff --git a/src/global/selectors/messages.ts b/src/global/selectors/messages.ts index f08597fca..f3db89c82 100644 --- a/src/global/selectors/messages.ts +++ b/src/global/selectors/messages.ts @@ -800,7 +800,9 @@ export function selectFirstUnreadId( return ( (!lastReadId || id > lastReadId) && byId[id] - && (!byId[id].isOutgoing || byId[id].isFromScheduled) + // For some reason outgoing topic actions are not marked as read, thus we need to mark them as read + // when the edit message hits the viewport + && ((!byId[id].isOutgoing || byId[id].content.action?.isTopicAction) || byId[id].isFromScheduled) && id > lastReadServiceNotificationId ); });