diff --git a/src/api/gramjs/updater.ts b/src/api/gramjs/updater.ts index 6bbec5b09..6c36480a0 100644 --- a/src/api/gramjs/updater.ts +++ b/src/api/gramjs/updater.ts @@ -594,6 +594,15 @@ export function updater(update: Update, originRequest?: GramJs.AnyRequest) { lastReadOutboxMessageId: update.maxId, }, }); + } else if (update instanceof GramJs.UpdateReadChannelDiscussionInbox) { + onUpdate({ + '@type': 'updateThreadInfo', + chatId: buildApiPeerId(update.channelId, 'channel'), + threadId: update.topMsgId, + threadInfo: { + lastReadInboxMessageId: update.readMaxId, + }, + }); } else if ( update instanceof GramJs.UpdateDialogPinned && update.peer instanceof GramJs.DialogPeer diff --git a/src/global/actions/apiUpdaters/messages.ts b/src/global/actions/apiUpdaters/messages.ts index b83d1727a..782e38c8a 100644 --- a/src/global/actions/apiUpdaters/messages.ts +++ b/src/global/actions/apiUpdaters/messages.ts @@ -361,6 +361,11 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => { global = replaceThreadParam(global, chatId, threadId, 'firstMessageId', firstMessageId); } + const chat = selectChat(global, chatId); + if (chat?.isForum && threadInfo.lastReadInboxMessageId !== currentThreadInfo?.lastReadInboxMessageId) { + actions.loadTopicById({ chatId, topicId: threadId }); + } + setGlobal(global); break;