Fix not all emoji-only messages being detected as jumbo emoji (#368)

This commit is contained in:
ginnyTheCat 2022-03-11 06:03:58 +01:00 committed by GitHub
parent 92607a788e
commit f0e9de4cf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -201,10 +201,10 @@ const MessageBody = React.memo(({
// Count the number of emojis
const nEmojis = content.filter((e) => e.type === 'img').length;
// Make sure there's no text besides whitespace
// Make sure there's no text besides whitespace and variation selector U+FE0F
if (nEmojis <= 10 && content.every((element) => (
(typeof element === 'object' && element.type === 'img')
|| (typeof element === 'string' && /^\s*$/g.test(element))
|| (typeof element === 'string' && /^[\s\ufe0f]*$/g.test(element))
))) {
emojiOnly = true;
}