From 8d81b90b7f3a3396dbf5f2ace4c99a6af16f6717 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Wed, 7 Dec 2022 13:54:48 -0500
Subject: [PATCH] interaction: do not rewrite author for outgoing interaction

Change-Id: I92d50aa0342a6d89e003cedabf1227fec029baeb
---
 src/app/commoncomponents/DataTransferMessageDelegate.qml | 2 +-
 src/app/commoncomponents/SBSMessageBase.qml              | 5 ++++-
 src/app/commoncomponents/TextMessageDelegate.qml         | 2 +-
 src/libclient/api/interaction.h                          | 4 +---
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/app/commoncomponents/DataTransferMessageDelegate.qml b/src/app/commoncomponents/DataTransferMessageDelegate.qml
index d54f764f8..12c8fe785 100644
--- a/src/app/commoncomponents/DataTransferMessageDelegate.qml
+++ b/src/app/commoncomponents/DataTransferMessageDelegate.qml
@@ -67,7 +67,7 @@ Loader {
                                        2 * hPadding - avatarBlockWidth
                                        - buttonsLoader.width - 24 - 6 - 24
 
-            isOutgoing: Author === ""
+            isOutgoing: Author === CurrentAccount.uri
             showTime: root.showTime
             seq: root.seq
             author: Author
diff --git a/src/app/commoncomponents/SBSMessageBase.qml b/src/app/commoncomponents/SBSMessageBase.qml
index 459988f47..113b53d94 100644
--- a/src/app/commoncomponents/SBSMessageBase.qml
+++ b/src/app/commoncomponents/SBSMessageBase.qml
@@ -231,6 +231,7 @@ Control {
                         } else {
                             y = 0
                         }
+
                         var distBorders = root.width - bubble.width - width
                         if (isOutgoing) {
                             if (distBorders > 0)
@@ -246,6 +247,7 @@ Control {
                     }
                 }
 
+
                 MessageBubble {
                     id: bubble
 
@@ -359,7 +361,7 @@ Control {
         EmojiReactions {
             id: emojiReaction
 
-            property bool isOutgoing: Author === ""
+            property bool isOutgoing: Author === CurrentAccount.uri
             Layout.alignment: isOutgoing ? Qt.AlignRight : Qt.AlignLeft
             Layout.rightMargin: isOutgoing ? status.width : undefined
             Layout.leftMargin: !isOutgoing ? avatarBlock.width : undefined
@@ -411,5 +413,6 @@ Control {
         id: reactionPopup
 
         emojiReaction: Reactions
+
     }
 }
diff --git a/src/app/commoncomponents/TextMessageDelegate.qml b/src/app/commoncomponents/TextMessageDelegate.qml
index 7016ccf9e..03ea53541 100644
--- a/src/app/commoncomponents/TextMessageDelegate.qml
+++ b/src/app/commoncomponents/TextMessageDelegate.qml
@@ -37,7 +37,7 @@ SBSMessageBase {
                                   JamiTheme.chatviewLinkColorLight :
                                   JamiTheme.chatviewLinkColorDark
 
-    isOutgoing: Author === ""
+    isOutgoing: Author === CurrentAccount.uri
     author: Author
     readers: Readers
     timestamp: Timestamp
diff --git a/src/libclient/api/interaction.h b/src/libclient/api/interaction.h
index 84e58df56..237060465 100644
--- a/src/libclient/api/interaction.h
+++ b/src/libclient/api/interaction.h
@@ -325,14 +325,12 @@ struct Info
         if (message.contains("react-to") && type == Type::TEXT) {
             type = to_type("REACTION");
             react_to = message["react-to"];
-            authorUri = message["author"];
         }
+        authorUri = message["author"];
 
         if (type == Type::TEXT || type == Type::EDITED || type == Type::REACTION) {
             body = message["body"];
         }
-        if (type != Type::REACTION)
-            authorUri = accountURI == message["author"] ? "" : message["author"];
         timestamp = message["timestamp"].toInt();
         status = Status::SUCCESS;
         parentId = message["linearizedParent"];
-- 
GitLab