From b0ea5e31f86a1d5d84cce33db054d5767b7b6236 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Fri, 11 Nov 2022 16:51:57 -0300 Subject: [PATCH] [FIX] Auto-translate feature wasn't working (#4678) --- app/containers/markdown/index.tsx | 20 +++++++++++++++----- app/containers/message/Content.tsx | 1 + app/containers/message/index.tsx | 6 +++++- app/containers/message/interfaces.ts | 1 + 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/app/containers/markdown/index.tsx b/app/containers/markdown/index.tsx index 27dc0ff37..ca8ce9271 100644 --- a/app/containers/markdown/index.tsx +++ b/app/containers/markdown/index.tsx @@ -45,6 +45,7 @@ interface IMarkdownProps { testID?: string; style?: StyleProp[]; onLinkPress?: TOnLinkPress; + isTranslated?: boolean; } type TLiteral = { @@ -93,9 +94,7 @@ class Markdown extends PureComponent { constructor(props: IMarkdownProps) { super(props); - if (!this.isNewMarkdown) { - this.renderer = this.createRenderer(); - } + this.renderer = this.createRenderer(); } createRenderer = () => @@ -310,13 +309,24 @@ class Markdown extends PureComponent { }; render() { - const { msg, md, mentions, channels, navToRoomInfo, useRealName, username = '', getCustomEmoji, onLinkPress } = this.props; + const { + msg, + md, + mentions, + channels, + navToRoomInfo, + useRealName, + username = '', + getCustomEmoji, + onLinkPress, + isTranslated + } = this.props; if (!msg) { return null; } - if (this.isNewMarkdown) { + if (this.isNewMarkdown && !isTranslated) { return ( ); } diff --git a/app/containers/message/index.tsx b/app/containers/message/index.tsx index 21d74de45..7c61c37f1 100644 --- a/app/containers/message/index.tsx +++ b/app/containers/message/index.tsx @@ -376,10 +376,13 @@ class MessageContainer extends React.Component ); diff --git a/app/containers/message/interfaces.ts b/app/containers/message/interfaces.ts index 9d0badb75..60edfb4df 100644 --- a/app/containers/message/interfaces.ts +++ b/app/containers/message/interfaces.ts @@ -63,6 +63,7 @@ export interface IMessageContent { comment?: string; hasError: boolean; isHeader: boolean; + isTranslated: boolean; } export interface IMessageEmoji {