mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Clear mention index when there are no messages
This commit is contained in:
parent
e35e3ccb89
commit
5a72fb3934
1 changed files with 13 additions and 1 deletions
|
|
@ -49,7 +49,19 @@ public func earliestUnseenPersonalMentionMessage(account: Account, peerId: PeerI
|
|||
return .single(.result(message.id))
|
||||
}
|
||||
} else {
|
||||
return .single(.result(nil))
|
||||
return account.postbox.transaction { transaction -> EarliestUnseenPersonalMentionMessageResult in
|
||||
if let topId = transaction.getTopPeerMessageId(peerId: peerId, namespace: Namespaces.Message.Cloud) {
|
||||
transaction.replaceMessageTagSummary(peerId: peerId, tagMask: .unseenPersonalMessage, namespace: Namespaces.Message.Cloud, count: 0, maxId: topId.id)
|
||||
|
||||
transaction.removeHole(peerId: peerId, namespace: Namespaces.Message.Cloud, space: .tag(.unseenPersonalMessage), range: 1 ... (Int32.max - 1))
|
||||
let ids = transaction.getMessageIndicesWithTag(peerId: peerId, namespace: Namespaces.Message.Cloud, tag: .unseenPersonalMessage).map({ $0.id })
|
||||
for id in ids {
|
||||
markUnseenPersonalMessage(transaction: transaction, id: id, addSynchronizeAction: false)
|
||||
}
|
||||
}
|
||||
|
||||
return .result(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|> distinctUntilChanged
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue