Merge pull request #2907 from matrix-org/anoa/no_big_pills_pls

Prevent user pills containing only emoji from embiggening
pull/21833/head
Travis Ralston 2019-04-17 10:15:16 -06:00 committed by GitHub
commit 9f494fcc58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -516,7 +516,11 @@ export function bodyToHtml(content, highlights, opts={}) {
contentBodyTrimmed = contentBodyTrimmed.replace(ZWJ_REGEX, ''); contentBodyTrimmed = contentBodyTrimmed.replace(ZWJ_REGEX, '');
const match = EMOJI_REGEX.exec(contentBodyTrimmed); const match = EMOJI_REGEX.exec(contentBodyTrimmed);
emojiBody = match && match[0] && match[0].length === contentBodyTrimmed.length; emojiBody = match && match[0] && match[0].length === contentBodyTrimmed.length
// Prevent user pills expanding for users with only emoji in
// their username
&& (content.formatted_body == undefined
|| !content.formatted_body.includes("https://matrix.to/"));
} }
const className = classNames({ const className = classNames({