From 026844e40b122a7b6db2b19fe4bc57c3b39590c7 Mon Sep 17 00:00:00 2001
From: Audric Ackermann <audric@loki.network>
Date: Wed, 15 Apr 2020 16:04:48 +1000
Subject: [PATCH] fix slaveMessages shown as someone else messages pubchats

When sending a message from a secondary device to a pubchat the
primary device would display this message on the left side on the
conversation view. It was due to the fact that the slaveDevices was not
built correctly.
---
 ts/components/conversation/Message.tsx | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/ts/components/conversation/Message.tsx b/ts/components/conversation/Message.tsx
index 16b7700c8..ccb45dbeb 100644
--- a/ts/components/conversation/Message.tsx
+++ b/ts/components/conversation/Message.tsx
@@ -1062,6 +1062,8 @@ export class Message extends React.PureComponent<Props, State> {
       selected,
       multiSelectMode,
       conversationType,
+      isPublic,
+      text,
     } = this.props;
     const { expired, expiring } = this.state;
 
@@ -1084,15 +1086,15 @@ export class Message extends React.PureComponent<Props, State> {
     // We parse the message later, but we still need to do an early check
     // to see if the message mentions us, so we can display the entire
     // message differently
-    const mentions = this.props.text
-      ? this.props.text.match(window.pubkeyPattern)
+    const mentions = text
+      ? text.match(window.pubkeyPattern)
       : [];
     const mentionMe =
       mentions &&
       mentions.some(m => m.slice(1) === window.lokiPublicChatAPI.ourKey);
 
     const isIncoming = direction === 'incoming';
-    const shouldHightlight = mentionMe && isIncoming && this.props.isPublic;
+    const shouldHightlight = mentionMe && isIncoming && isPublic;
     const divClasses = ['loki-message-wrapper'];
 
     if (shouldHightlight) {