Forums: Update topic message counter on server update (#2524)
This commit is contained in:
parent
ca01d03190
commit
4b2c83b5ba
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user