mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Fix read top topic message
This commit is contained in:
parent
8b10c87d66
commit
c71d9f3395
@ -3574,7 +3574,8 @@ func replayFinalState(
|
||||
updatedIncomingThreadReadStates[threadMessageId] = readMaxId
|
||||
}
|
||||
if let channel = transaction.getPeer(threadMessageId.peerId) as? TelegramChannel, case .group = channel.info, channel.flags.contains(.isForum) {
|
||||
if var data = transaction.getMessageHistoryThreadInfo(peerId: threadMessageId.peerId, threadId: Int64(threadMessageId.id))?.data.get(MessageHistoryThreadData.self) {
|
||||
let threadId = Int64(threadMessageId.id)
|
||||
if var data = transaction.getMessageHistoryThreadInfo(peerId: threadMessageId.peerId, threadId: threadId)?.data.get(MessageHistoryThreadData.self) {
|
||||
if readMaxId > data.maxIncomingReadId {
|
||||
if let toIndex = transaction.getMessage(MessageId(peerId: threadMessageId.peerId, namespace: threadMessageId.namespace, id: readMaxId))?.index {
|
||||
if let count = transaction.getThreadMessageCount(peerId: threadMessageId.peerId, threadId: Int64(threadMessageId.id), namespace: threadMessageId.namespace, fromIdExclusive: data.maxIncomingReadId, toIndex: toIndex) {
|
||||
@ -3582,6 +3583,16 @@ func replayFinalState(
|
||||
}
|
||||
}
|
||||
|
||||
if let topMessageIndex = transaction.getMessageHistoryThreadTopMessage(peerId: threadMessageId.peerId, threadId: threadId, namespaces: Set([Namespaces.Message.Cloud])) {
|
||||
if readMaxId >= topMessageIndex.id.id {
|
||||
let containingHole = transaction.getThreadIndexHole(peerId: threadMessageId.peerId, threadId: threadId, namespace: topMessageIndex.id.namespace, containing: topMessageIndex.id.id)
|
||||
if let _ = containingHole[.everywhere] {
|
||||
} else {
|
||||
data.incomingUnreadCount = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.maxKnownMessageId = max(data.maxKnownMessageId, readMaxId)
|
||||
data.maxIncomingReadId = max(data.maxIncomingReadId, readMaxId)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user