diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Data/PeersData.swift b/submodules/TelegramCore/Sources/TelegramEngine/Data/PeersData.swift index 842e7d34c6f..eacb8de5a24 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Data/PeersData.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Data/PeersData.swift @@ -1037,7 +1037,8 @@ public extension TelegramEngine.EngineData.Item { func keys(data: TelegramEngine.EngineData) -> [PostboxViewKey] { return [ .cachedPeerData(peerId: self.id), - .basicPeer(data.accountPeerId) + .basicPeer(data.accountPeerId), + .basicPeer(self.id) ] } @@ -1046,6 +1047,10 @@ public extension TelegramEngine.EngineData.Item { assertionFailure() return false } + guard let basicTargetPeerView = views[.basicPeer(self.id)] as? BasicPeerView else { + assertionFailure() + return false + } guard let view = views[.cachedPeerData(peerId: self.id)] as? CachedPeerDataView else { assertionFailure() return false @@ -1055,6 +1060,13 @@ public extension TelegramEngine.EngineData.Item { return false } + guard let targetPeer = basicTargetPeerView.peer as? TelegramUser else { + return false + } + if !targetPeer.flags.contains(.requirePremium) { + return false + } + if self.id.namespace == Namespaces.Peer.CloudUser { if let cachedData = view.cachedPeerData as? CachedUserData { return cachedData.flags.contains(.premiumRequired)