Fix general hide/unhide

This commit is contained in:
Ali 2022-11-18 19:44:48 +04:00
parent 0697f5f8dd
commit dd37aa9684
2 changed files with 20 additions and 2 deletions

View File

@ -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

View File

@ -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<Api.Updates?, NoError> in
return .single(nil)
}
|> mapError { _ -> EditForumChannelTopicError in
return .generic
}
|> mapToSignal { result -> Signal<Never, EditForumChannelTopicError> in
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) {