diff --git a/submodules/ChatListUI/Sources/ChatListControllerNode.swift b/submodules/ChatListUI/Sources/ChatListControllerNode.swift index cc9e781ce2..4615477753 100644 --- a/submodules/ChatListUI/Sources/ChatListControllerNode.swift +++ b/submodules/ChatListUI/Sources/ChatListControllerNode.swift @@ -1640,6 +1640,7 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate { inlineStackContainerNode.deletePeerThread = self.containerNode.deletePeerThread inlineStackContainerNode.setPeerThreadStopped = self.containerNode.setPeerThreadStopped inlineStackContainerNode.setPeerThreadPinned = self.containerNode.setPeerThreadPinned + inlineStackContainerNode.setPeerThreadHidden = self.containerNode.setPeerThreadHidden inlineStackContainerNode.peerSelected = self.containerNode.peerSelected inlineStackContainerNode.groupSelected = self.containerNode.groupSelected inlineStackContainerNode.updatePeerGrouping = self.containerNode.updatePeerGrouping diff --git a/submodules/TelegramCore/Sources/ForumChannels.swift b/submodules/TelegramCore/Sources/ForumChannels.swift index 1e9044dae7..afe2d4c9a6 100644 --- a/submodules/TelegramCore/Sources/ForumChannels.swift +++ b/submodules/TelegramCore/Sources/ForumChannels.swift @@ -380,6 +380,18 @@ func _internal_setForumChannelTopicHidden(account: Account, id: EnginePeer.Id, t return .fail(.generic) } return account.postbox.transaction { transaction -> Api.InputChannel? in + if let initialData = transaction.getMessageHistoryThreadInfo(peerId: id, threadId: threadId)?.data.get(MessageHistoryThreadData.self) { + var data = initialData + + data.isHidden = isHidden + + if data != initialData { + if let entry = StoredMessageHistoryThreadInfo(data) { + transaction.setMessageHistoryThreadInfo(peerId: id, threadId: threadId, info: entry) + } + } + } + return transaction.getPeer(id).flatMap(apiInputChannel) } |> castError(EditForumChannelTopicError.self) @@ -399,11 +411,16 @@ func _internal_setForumChannelTopicHidden(account: Account, id: EnginePeer.Id, t closed: nil, hidden: isHidden ? .boolTrue : .boolFalse )) + |> map(Optional.init) + |> `catch` { _ -> Signal in + return .single(nil) + } |> mapError { _ -> EditForumChannelTopicError in - return .generic } |> mapToSignal { result -> Signal in - account.stateManager.addUpdates(result) + if let result = result { + account.stateManager.addUpdates(result) + } return account.postbox.transaction { transaction -> Void in if let initialData = transaction.getMessageHistoryThreadInfo(peerId: id, threadId: threadId)?.data.get(MessageHistoryThreadData.self) {