Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(chat): avoid emoji accidents when sending messages (#15854)

zxshend370e79237b7
diff --git a/react/features/base/react/components/web/Message.tsx b/react/features/base/react/components/web/Message.tsx
index 06c9f6c9a9..2a54473c4b 100644
--- a/react/features/base/react/components/web/Message.tsx
+++ b/react/features/base/react/components/web/Message.tsx
@@ -54,7 +54,7 @@ class Message extends Component<IProps> {
// Tokenize the text in order to avoid emoji substitution for URLs
const tokens = text ? text.split(' ') : [];
- const content = [];
+ const content: any[] = [];
const { gifEnabled } = this.props;
// check if the message is a GIF
@@ -72,7 +72,11 @@ class Message extends Component<IProps> {
// Bypass the emojification when urls or matrix ids are involved
content.push(token);
} else {
- content.push(...toArray(token, { className: 'smiley' }));
+ const emojified = [ ...toArray(token, { className: 'smiley' }) ];
+
+ content.push(
+ ...emojified.some(item => typeof item === 'string') ? [ token ] : emojified
+ );
}
content.push(' ');