From 74fbca5705c507ccfe90c0e0428d6c0c9886d3e9 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Wed, 18 Dec 2019 22:33:53 +0400 Subject: [PATCH] Don't delete remote messages when deleting local ones --- .../Sources/DeleteMessagesInteractively.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/submodules/TelegramCore/Sources/DeleteMessagesInteractively.swift b/submodules/TelegramCore/Sources/DeleteMessagesInteractively.swift index 2d45771b69..bfaea152fe 100644 --- a/submodules/TelegramCore/Sources/DeleteMessagesInteractively.swift +++ b/submodules/TelegramCore/Sources/DeleteMessagesInteractively.swift @@ -35,7 +35,15 @@ public func deleteMessagesInteractively(postbox: Postbox, messageIds initialMess } for (peerId, peerMessageIds) in messageIdsByPeerId { if peerId.namespace == Namespaces.Peer.CloudChannel || peerId.namespace == Namespaces.Peer.CloudGroup || peerId.namespace == Namespaces.Peer.CloudUser { - cloudChatAddRemoveMessagesOperation(transaction: transaction, peerId: peerId, messageIds: peerMessageIds, type: CloudChatRemoveMessagesType(type)) + let remoteMessageIds = peerMessageIds.filter { id in + if id.namespace == Namespaces.Message.Local { + return false + } + return true + } + if !remoteMessageIds.isEmpty { + cloudChatAddRemoveMessagesOperation(transaction: transaction, peerId: peerId, messageIds: remoteMessageIds, type: CloudChatRemoveMessagesType(type)) + } } else if peerId.namespace == Namespaces.Peer.SecretChat { if let state = transaction.getPeerChatState(peerId) as? SecretChatState { var layer: SecretChatLayer?