treat mentions to our primary as us from secondary

pull/1294/head
Audric Ackermann 5 years ago
parent 12ec5beb95
commit b237d20e62
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -2,6 +2,7 @@ import React from 'react';
import { RenderTextCallbackType } from '../../types/Util'; import { RenderTextCallbackType } from '../../types/Util';
import classNames from 'classnames'; import classNames from 'classnames';
import { MultiDeviceProtocol } from '../../session/protocols';
declare global { declare global {
interface Window { interface Window {
@ -19,6 +20,7 @@ interface MentionProps {
interface MentionState { interface MentionState {
found: any; found: any;
us: boolean;
} }
class Mention extends React.Component<MentionProps, MentionState> { class Mention extends React.Component<MentionProps, MentionState> {
@ -45,8 +47,7 @@ class Mention extends React.Component<MentionProps, MentionState> {
public render() { public render() {
if (this.state.found) { if (this.state.found) {
// TODO: We don't have to search the database of message just to know that the message is for us! // TODO: We don't have to search the database of message just to know that the message is for us!
const us = const us = this.state.us;
this.state.found.authorPhoneNumber === window.lokiPublicChatAPI.ourKey;
const className = classNames( const className = classNames(
'mention-profile-name', 'mention-profile-name',
us && 'mention-profile-name-us' us && 'mention-profile-name-us'
@ -73,7 +74,9 @@ class Mention extends React.Component<MentionProps, MentionState> {
private async tryRenameMention() { private async tryRenameMention() {
const found = await this.findMember(this.props.text.slice(1)); const found = await this.findMember(this.props.text.slice(1));
if (found) { if (found) {
this.setState({ found }); const us = await MultiDeviceProtocol.isOurDevice(found.authorPhoneNumber);
this.setState({ found, us });
this.clearOurInterval(); this.clearOurInterval();
} }
} }

Loading…
Cancel
Save