jumbo emoji-only message with whitespace

This commit is contained in:
Jamie Kyle 2023-02-06 13:40:49 -08:00 committed by GitHub
parent b6c395fac1
commit 8b5fa7039d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 57 deletions

View file

@ -80,8 +80,7 @@ import type {
CustomColorType,
} from '../../types/Colors';
import { createRefMerger } from '../../util/refMerger';
import { emojiToData, getEmojiCount } from '../emoji/lib';
import { isEmojiOnlyText } from '../../util/isEmojiOnlyText';
import { emojiToData, getEmojiCount, hasNonEmojiText } from '../emoji/lib';
import { getCustomColorStyle } from '../../util/getCustomColorStyle';
import type { UUIDStringType } from '../../types/UUID';
import { DAY, HOUR, MINUTE, SECOND } from '../../util/durations';
@ -715,7 +714,7 @@ export class Message extends React.PureComponent<Props, State> {
return Boolean(
text &&
isEmojiOnlyText(text) &&
!hasNonEmojiText(text) &&
getEmojiCount(text) < 6 &&
!quote &&
!storyReplyContext &&

View file

@ -328,9 +328,13 @@ export function getEmojiCount(str: string): number {
return count;
}
export function hasNonEmojiText(str: string): boolean {
return str.replace(emojiRegex(), '').trim().length > 0;
}
export function getSizeClass(str: string): SizeClassType {
// Do we have non-emoji characters?
if (str.replace(emojiRegex(), '').trim().length > 0) {
if (hasNonEmojiText(str)) {
return '';
}