Fix pinning in folders

This commit is contained in:
Ilya Laktyushin
2022-08-15 23:10:51 +03:00
parent a1e2dd0b0e
commit 4982c780a2
4 changed files with 63 additions and 43 deletions

View File

@@ -42,9 +42,6 @@ func _internal_toggleItemPinned(postbox: Postbox, accountPeerId: PeerId, locatio
additionalCount = 1
}
let limitCount: Int
if case .root = groupId {
limitCount = Int(userLimitsConfiguration.maxPinnedChatCount)
@@ -76,8 +73,10 @@ func _internal_toggleItemPinned(postbox: Postbox, accountPeerId: PeerId, locatio
if updatedData.includePeers.pinnedPeers.contains(peerId) {
updatedData.includePeers.removePinnedPeer(peerId)
} else {
if !updatedData.includePeers.addPinnedPeer(peerId) {
let _ = updatedData.includePeers.addPinnedPeer(peerId)
if updatedData.includePeers.peers.count > userLimitsConfiguration.maxFolderChatsCount {
result = .limitExceeded(count: updatedData.includePeers.peers.count, limit: Int(userLimitsConfiguration.maxFolderChatsCount))
updatedData = data
}
}
filters[index] = .filter(id: id, title: title, emoticon: emoticon, data: updatedData)