From 44c705e41c73676f27c96d9c8975330391ffc71a Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 21 Dec 2020 15:24:59 +0000 Subject: [PATCH] Look for emoji in the body that will be displayed Fixes https://github.com/vector-im/element-web/issues/16013 --- src/HtmlUtils.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/HtmlUtils.tsx b/src/HtmlUtils.tsx index ba0781f0a4..637c0a2696 100644 --- a/src/HtmlUtils.tsx +++ b/src/HtmlUtils.tsx @@ -438,13 +438,14 @@ export function bodyToHtml(content: IContent, highlights: string[], opts: IOpts delete sanitizeParams.textFilter; } + const contentBody = isDisplayedWithHtml ? safeBody : strippedBody; if (opts.returnString) { - return isDisplayedWithHtml ? safeBody : strippedBody; + return contentBody; } let emojiBody = false; if (!opts.disableBigEmoji && bodyHasEmoji) { - let contentBodyTrimmed = strippedBody !== undefined ? strippedBody.trim() : ''; + let contentBodyTrimmed = contentBody !== undefined ? contentBody.trim() : ''; // Ignore spaces in body text. Emojis with spaces in between should // still be counted as purely emoji messages.