fix(chat): Update new messages marker when message was removed

Fixes: #9014
This commit is contained in:
Boris Melnik 2023-01-11 17:22:55 +03:00 committed by Jonathan Rainville
parent 7c4022e4ac
commit c2f84fd882
1 changed files with 4 additions and 1 deletions

View File

@ -77,6 +77,8 @@ QtObject:
[{i}]:({$self.items[i]})
"""
proc resetNewMessagesMarker*(self: Model)
proc countChanged(self: Model) {.signal.}
proc getCount(self: Model): int {.slot.} =
self.items.len
@ -297,6 +299,8 @@ QtObject:
self.items.delete(ind)
self.endRemoveRows()
self.resetNewMessagesMarker()
if ind > 0 and ind < self.items.len:
self.updateItemAtIndex(ind - 1)
if ind + 1 < self.items.len:
@ -503,7 +507,6 @@ QtObject:
self.endRemoveRows()
self.countChanged()
# TODO: handle messages removal
proc resetNewMessagesMarker*(self: Model) =
self.removeNewMessagesMarker()
let messageId = self.firstUnseenMessageId