Exclude jumbo style for single emoji in quotes or attachments

This commit is contained in:
Josh Perez 2021-10-07 20:27:46 -04:00 committed by GitHub
parent 096849cc00
commit a25690b3bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 96 additions and 7 deletions

View file

@ -590,6 +590,19 @@ export class Message extends React.PureComponent<Props, State> {
return isMessageRequestAccepted && !isBlocked;
}
private canRenderStickerLikeEmoji(): boolean {
const { text, quote, attachments, previews } = this.props;
return Boolean(
text &&
isEmojiOnlyText(text) &&
getEmojiCount(text) < 6 &&
!quote &&
(!attachments || !attachments.length) &&
(!previews || !previews.length)
);
}
public renderMetadata(): JSX.Element | null {
const {
attachments,
@ -619,10 +632,7 @@ export class Message extends React.PureComponent<Props, State> {
return null;
}
const isEmojiOnly = Boolean(
text && isEmojiOnlyText(text) && getEmojiCount(text) < 6
);
const isStickerLike = isSticker || isEmojiOnly;
const isStickerLike = isSticker || this.canRenderStickerLikeEmoji();
return (
<MessageMetadata
@ -2331,7 +2341,6 @@ export class Message extends React.PureComponent<Props, State> {
isTapToView,
isTapToViewExpired,
isTapToViewError,
text,
} = this.props;
const { isSelected } = this.state;
@ -2340,8 +2349,7 @@ export class Message extends React.PureComponent<Props, State> {
const width = this.getWidth();
const isShowingImage = this.isShowingImage();
const isEmojiOnly =
text && isEmojiOnlyText(text) && getEmojiCount(text) < 6;
const isEmojiOnly = this.canRenderStickerLikeEmoji();
const isStickerLike = isSticker || isEmojiOnly;
const containerClassnames = classNames(