mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Filter duplicate group ids
This commit is contained in:
parent
579fa24c3e
commit
e308512bfd
1 changed files with 15 additions and 3 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue