Don't count chats that the use can't join

This commit is contained in:
Ali 2023-04-04 17:34:27 +04:00
parent 0e1dd66b04
commit 6658280ed8

View File

@ -410,9 +410,20 @@ func _internal_joinChatFolderLink(account: Account, slug: String, peerIds: [Engi
var newChatCount = 0 var newChatCount = 0
for peerId in peerIds { for peerId in peerIds {
if transaction.getPeerChatListIndex(peerId) == nil { if transaction.getPeerChatListIndex(peerId) == nil {
var canJoin = true
if let peer = transaction.getPeer(peerId) {
if let channel = peer as? TelegramChannel {
if case .kicked = channel.participationStatus {
canJoin = false
}
}
}
if canJoin {
newChatCount += 1 newChatCount += 1
} }
} }
}
return (peerIds.compactMap(transaction.getPeer).compactMap(apiInputPeer), newChatCount) return (peerIds.compactMap(transaction.getPeer).compactMap(apiInputPeer), newChatCount)
} }