diff --git a/submodules/AccountContext/Sources/ChatController.swift b/submodules/AccountContext/Sources/ChatController.swift index 11981560db..3f5317543f 100644 --- a/submodules/AccountContext/Sources/ChatController.swift +++ b/submodules/AccountContext/Sources/ChatController.swift @@ -732,6 +732,15 @@ public enum ChatControllerSubject: Equatable { } } } + + public var isService: Bool { + switch self { + case .message: + return false + default: + return true + } + } } public enum ChatControllerPresentationMode: Equatable { diff --git a/submodules/TelegramUI/Sources/ChatHistoryEntriesForView.swift b/submodules/TelegramUI/Sources/ChatHistoryEntriesForView.swift index d5267b0683..379772d9a6 100644 --- a/submodules/TelegramUI/Sources/ChatHistoryEntriesForView.swift +++ b/submodules/TelegramUI/Sources/ChatHistoryEntriesForView.swift @@ -54,58 +54,62 @@ func chatHistoryEntriesForView( } var joinMessage: Message? - if case let .peer(peerId) = location, case let cachedData = cachedData as? CachedChannelData, let invitedOn = cachedData?.invitedOn { - joinMessage = Message( - stableId: UInt32.max - 1000, - stableVersion: 0, - id: MessageId(peerId: peerId, namespace: Namespaces.Message.Local, id: 0), - globallyUniqueId: nil, - groupingKey: nil, - groupInfo: nil, - threadId: nil, - timestamp: invitedOn, - flags: [.Incoming], - tags: [], - globalTags: [], - localTags: [], - forwardInfo: nil, - author: channelPeer, - text: "", - attributes: [], - media: [TelegramMediaAction(action: .joinedByRequest)], - peers: SimpleDictionary(), - associatedMessages: SimpleDictionary(), - associatedMessageIds: [], - associatedMedia: [:], - associatedThreadInfo: nil, - associatedStories: [:] - ) - } else if let peer = channelPeer as? TelegramChannel, case .broadcast = peer.info, case .member = peer.participationStatus { - joinMessage = Message( - stableId: UInt32.max - 1000, - stableVersion: 0, - id: MessageId(peerId: peer.id, namespace: Namespaces.Message.Local, id: 0), - globallyUniqueId: nil, - groupingKey: nil, - groupInfo: nil, - threadId: nil, - timestamp: peer.creationDate, - flags: [.Incoming], - tags: [], - globalTags: [], - localTags: [], - forwardInfo: nil, - author: channelPeer, - text: "", - attributes: [], - media: [TelegramMediaAction(action: .joinedChannel)], - peers: SimpleDictionary(), - associatedMessages: SimpleDictionary(), - associatedMessageIds: [], - associatedMedia: [:], - associatedThreadInfo: nil, - associatedStories: [:] - ) + if (associatedData.subject?.isService ?? false) { + + } else { + if case let .peer(peerId) = location, case let cachedData = cachedData as? CachedChannelData, let invitedOn = cachedData?.invitedOn { + joinMessage = Message( + stableId: UInt32.max - 1000, + stableVersion: 0, + id: MessageId(peerId: peerId, namespace: Namespaces.Message.Local, id: 0), + globallyUniqueId: nil, + groupingKey: nil, + groupInfo: nil, + threadId: nil, + timestamp: invitedOn, + flags: [.Incoming], + tags: [], + globalTags: [], + localTags: [], + forwardInfo: nil, + author: channelPeer, + text: "", + attributes: [], + media: [TelegramMediaAction(action: .joinedByRequest)], + peers: SimpleDictionary(), + associatedMessages: SimpleDictionary(), + associatedMessageIds: [], + associatedMedia: [:], + associatedThreadInfo: nil, + associatedStories: [:] + ) + } else if let peer = channelPeer as? TelegramChannel, case .broadcast = peer.info, case .member = peer.participationStatus { + joinMessage = Message( + stableId: UInt32.max - 1000, + stableVersion: 0, + id: MessageId(peerId: peer.id, namespace: Namespaces.Message.Local, id: 0), + globallyUniqueId: nil, + groupingKey: nil, + groupInfo: nil, + threadId: nil, + timestamp: peer.creationDate, + flags: [.Incoming], + tags: [], + globalTags: [], + localTags: [], + forwardInfo: nil, + author: channelPeer, + text: "", + attributes: [], + media: [TelegramMediaAction(action: .joinedChannel)], + peers: SimpleDictionary(), + associatedMessages: SimpleDictionary(), + associatedMessageIds: [], + associatedMedia: [:], + associatedThreadInfo: nil, + associatedStories: [:] + ) + } } var existingGroupStableIds: [UInt32] = []