From abc135f25751a36ab31e79bc7d74cae05451ea77 Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Tue, 6 Jan 2026 23:22:18 +0800 Subject: [PATCH] Fix botforum topic removal --- ...gedCloudChatRemoveMessagesOperations.swift | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift b/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift index 70157349e0..70455804df 100644 --- a/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift +++ b/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift @@ -479,6 +479,26 @@ private func _internal_clearHistory(transaction: Transaction, postbox: Postbox, |> `catch` { _ -> Signal in return .complete() } + } else if let threadId = operation.threadId { + guard let inputPeer = apiInputPeer(peer) else { + return .complete() + } + return network.request(Api.functions.messages.deleteTopicHistory(peer: inputPeer, topMsgId: Int32(clamping: threadId))) + |> map(Optional.init) + |> `catch` { _ -> Signal in + return .single(nil) + } + |> mapToSignal { result -> Signal in + if let result = result { + switch result { + case let .affectedHistory(pts, ptsCount, offset): + stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)]) + return .complete() + } + } else { + return .complete() + } + } } else { return requestClearHistory(postbox: postbox, network: network, stateManager: stateManager, inputPeer: inputPeer, maxId: operation.topMessageId.id, justClear: true, minTimestamp: operation.minTimestamp, maxTimestamp: operation.maxTimestamp, type: operation.type) }