mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Filter duplicate group ids
This commit is contained in:
@@ -77,7 +77,8 @@ func chatHistoryEntriesForView(
|
||||
associatedThreadInfo: nil
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
var existingGroupStableIds: [UInt32] = []
|
||||
var groupBucket: [(Message, Bool, ChatHistoryMessageSelection, ChatMessageEntryAttributes, MessageHistoryEntryLocation?)] = []
|
||||
var count = 0
|
||||
loop: for entry in view.entries {
|
||||
@@ -156,7 +157,11 @@ func chatHistoryEntriesForView(
|
||||
|
||||
if groupMessages {
|
||||
if !groupBucket.isEmpty && message.groupInfo != groupBucket[0].0.groupInfo {
|
||||
entries.append(.MessageGroupEntry(groupBucket[0].0.groupInfo!, groupBucket, presentationData))
|
||||
let groupStableId = groupBucket[0].0.groupInfo!.stableId
|
||||
if !existingGroupStableIds.contains(groupStableId) {
|
||||
existingGroupStableIds.append(groupStableId)
|
||||
entries.append(.MessageGroupEntry(groupBucket[0].0.groupInfo!, groupBucket, presentationData))
|
||||
}
|
||||
groupBucket.removeAll()
|
||||
}
|
||||
if let _ = message.groupInfo {
|
||||
@@ -189,7 +194,14 @@ func chatHistoryEntriesForView(
|
||||
|
||||
if !groupBucket.isEmpty {
|
||||
assert(groupMessages)
|
||||
entries.append(.MessageGroupEntry(groupBucket[0].0.groupInfo!, groupBucket, presentationData))
|
||||
|
||||
let groupStableId = groupBucket[0].0.groupInfo!.stableId
|
||||
if !existingGroupStableIds.contains(groupStableId) {
|
||||
existingGroupStableIds.append(groupStableId)
|
||||
entries.append(.MessageGroupEntry(groupBucket[0].0.groupInfo!, groupBucket, presentationData))
|
||||
}
|
||||
|
||||
groupBucket.removeAll()
|
||||
}
|
||||
|
||||
if let maybeJoinMessage = joinMessage, !view.holeLater {
|
||||
|
||||
Reference in New Issue
Block a user