From 7969dd881e0558ad1754a2e09ca70c1941a3ef12 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Wed, 16 Aug 2023 16:06:40 -0700 Subject: [PATCH] Use shouldLinkifyMessage in MessageBody/ReadMore --- ts/components/conversation/MessageBody.tsx | 5 ++++- ts/components/conversation/MessageBodyReadMore.tsx | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ts/components/conversation/MessageBody.tsx b/ts/components/conversation/MessageBody.tsx index 4693e6aa78..2389397391 100644 --- a/ts/components/conversation/MessageBody.tsx +++ b/ts/components/conversation/MessageBody.tsx @@ -14,6 +14,7 @@ import type { LocalizerType } from '../../types/Util'; import { MessageTextRenderer } from './MessageTextRenderer'; import type { RenderLocation } from './MessageTextRenderer'; import { UserText } from '../UserText'; +import { shouldLinkifyMessage } from '../../types/LinkPreview'; export type Props = { author?: string; @@ -59,6 +60,8 @@ export function MessageBody({ textAttachment, }: Props): JSX.Element { const hasReadMore = Boolean(onIncreaseTextLength); + + const shouldDisableLinks = disableLinks || !shouldLinkifyMessage(text); const textWithSuffix = textAttachment?.pending || hasReadMore ? `${text}...` : text; @@ -119,7 +122,7 @@ export function MessageBody({