feat(messaging): Skip deleted and deletedForMe messages

Fixes: #8369
This commit is contained in:
Boris Melnik 2022-11-23 17:38:11 +03:00
parent 366a006c4c
commit 5c7dc4c330
2 changed files with 15 additions and 1 deletions

View File

@ -171,6 +171,11 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
if(messages.len > 0):
for m in messages:
# https://github.com/status-im/status-desktop/issues/7632 will introduce deleteFroMe feature.
# Now we just skip deleted messages
if m.deleted or m.deletedForMe:
continue
let sender = self.controller.getContactDetails(m.`from`)
let renderedMessageText = self.controller.getRenderedText(m.parsedText)
@ -274,7 +279,12 @@ method messageAdded*(self: Module, message: MessageDto) =
let index = self.view.model().findIndexForMessageId(message.replace)
if(index != -1):
self.view.model().removeItem(message.replace)
# https://github.com/status-im/status-desktop/issues/7632 will introduce deleteFroMe feature.
# Now we just skip deleted messages
if message.deleted or message.deletedForMe:
return
var item = initItem(
message.id,
message.communityId,

View File

@ -104,6 +104,8 @@ type MessageDto* = object
contactRequestState*: int
links*: seq[string]
editedAt*: int
deleted*: bool
deletedForMe*: bool
transactionParameters*: TransactionParameters
proc toParsedText*(jsonObj: JsonNode): ParsedText =
@ -208,6 +210,8 @@ proc toMessageDto*(jsonObj: JsonNode): MessageDto =
discard jsonObj.getProp("contactRequestState", result.contactRequestState)
discard jsonObj.getProp("image", result.image)
discard jsonObj.getProp("editedAt", result.editedAt)
discard jsonObj.getProp("deleted", result.deleted)
discard jsonObj.getProp("deletedForMe", result.deletedForMe)
var quotedMessageObj: JsonNode
if(jsonObj.getProp("quotedMessage", quotedMessageObj)):