ChatListController: another fix for chat removal

This commit is contained in:
Peter Iakovlev 2019-03-21 18:59:11 +04:00
parent 550fba29a1
commit 72cada65a1

View File

@ -381,7 +381,16 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie
guard let strongSelf = self, let peer = peer, let chatPeer = peer.peers[peer.peerId], let mainPeer = peer.chatMainPeer else {
return
}
if let user = chatPeer as? TelegramUser, user.botInfo == nil {
var canRemoveGlobally = false
let limitsConfiguration = strongSelf.context.currentLimitsConfiguration.with { $0 }
if peer.peerId.namespace == Namespaces.Peer.CloudUser && peer.peerId != strongSelf.context.account.peerId {
if limitsConfiguration.maxMessageRevokeIntervalInPrivateChats == LimitsConfiguration.timeIntervalForever {
canRemoveGlobally = true
}
}
if let user = chatPeer as? TelegramUser, user.botInfo == nil, canRemoveGlobally {
strongSelf.maybeAskForPeerChatRemoval(peer: peer, completion: { _ in })
} else {
let actionSheet = ActionSheetController(presentationTheme: strongSelf.presentationData.theme)