From b237d20e620caa250a926e855147de67eb3d2286 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Thu, 30 Jul 2020 12:44:47 +1000 Subject: [PATCH] treat mentions to our primary as us from secondary --- ts/components/conversation/AddMentions.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ts/components/conversation/AddMentions.tsx b/ts/components/conversation/AddMentions.tsx index ae7a50dde..26c079ee1 100644 --- a/ts/components/conversation/AddMentions.tsx +++ b/ts/components/conversation/AddMentions.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { RenderTextCallbackType } from '../../types/Util'; import classNames from 'classnames'; +import { MultiDeviceProtocol } from '../../session/protocols'; declare global { interface Window { @@ -19,6 +20,7 @@ interface MentionProps { interface MentionState { found: any; + us: boolean; } class Mention extends React.Component { @@ -45,8 +47,7 @@ class Mention extends React.Component { public render() { if (this.state.found) { // TODO: We don't have to search the database of message just to know that the message is for us! - const us = - this.state.found.authorPhoneNumber === window.lokiPublicChatAPI.ourKey; + const us = this.state.us; const className = classNames( 'mention-profile-name', us && 'mention-profile-name-us' @@ -73,7 +74,9 @@ class Mention extends React.Component { private async tryRenameMention() { const found = await this.findMember(this.props.text.slice(1)); if (found) { - this.setState({ found }); + const us = await MultiDeviceProtocol.isOurDevice(found.authorPhoneNumber); + + this.setState({ found, us }); this.clearOurInterval(); } }