Force remove timestamp based attributes

This commit is contained in:
Ali 2022-03-11 18:27:29 +04:00
parent 70b479b304
commit 39580a0d2e
2 changed files with 3 additions and 2 deletions

View File

@ -82,8 +82,9 @@ final class TimestampBasedMessageAttributesTable: Table {
if let previousTimestamp = previousTimestamp { if let previousTimestamp = previousTimestamp {
self.valueBox.remove(self.table, key: self.key(tag: tag, timestamp: previousTimestamp, id: id), secure: false) self.valueBox.remove(self.table, key: self.key(tag: tag, timestamp: previousTimestamp, id: id), secure: false)
self.indexTable.remove(tag: tag, id: id) self.indexTable.remove(tag: tag, id: id)
operations.append(.remove(TimestampBasedMessageAttributesEntry(tag: tag, timestamp: previousTimestamp, messageId: id)))
} }
operations.append(.remove(TimestampBasedMessageAttributesEntry(tag: tag, timestamp: previousTimestamp ?? 0, messageId: id)))
} }
func head(tag: UInt16) -> TimestampBasedMessageAttributesEntry? { func head(tag: UInt16) -> TimestampBasedMessageAttributesEntry? {

View File

@ -30,7 +30,7 @@ final class MutableTimestampBasedMessageAttributesView {
} }
case let .remove(entry): case let .remove(entry):
if entry.tag == self.tag { if entry.tag == self.tag {
if let head = self.head, head.index == entry.index { if let head = self.head, head.messageId == entry.messageId {
self.head = nil self.head = nil
updated = true updated = true
invalidatedHead = true invalidatedHead = true