[fractal/fractal-next] message-row: Fix event's content replacement



commit ee8e1770b49119acfa7f91f6245b7286bc34e51f
Author: Kévin Commaille <zecakeh tedomum fr>
Date:   Sat Nov 13 11:54:11 2021 +0100

    message-row: Fix event's content replacement
    
    Only replace content with Relation::Replacement events
    
    Fixes #828 and #861

 src/session/content/message_row.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/session/content/message_row.rs b/src/session/content/message_row.rs
index 5d9fbdc0..cf84584c 100644
--- a/src/session/content/message_row.rs
+++ b/src/session/content/message_row.rs
@@ -193,7 +193,11 @@ impl MessageRow {
             let matrix_event = event.matrix_event();
             match matrix_event {
                 Some(AnySyncRoomEvent::Message(AnySyncMessageEvent::RoomMessage(message))) => {
-                    message.content.relates_to.is_some()
+                    message
+                        .content
+                        .relates_to
+                        .filter(|relation| matches!(relation, Relation::Replacement(_)))
+                        .is_some()
                 }
                 Some(AnySyncRoomEvent::Message(AnySyncMessageEvent::RoomRedaction(_))) => true,
                 _ => false,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]