MM-13666 Detect post as emoji only if not a codeblock (#2497)
* Detect post as emoji only if not a codeblock * Feedback review Co-Authored-By: enahum <nahumhbl@gmail.com> * Feedback review Co-Authored-By: enahum <nahumhbl@gmail.com>
This commit is contained in:
parent
54c3ee97c4
commit
1a8be5444c
2 changed files with 5 additions and 1 deletions
|
|
@ -46,7 +46,7 @@ function isEmoticon(text) {
|
|||
}
|
||||
|
||||
export function hasEmojisOnly(message, customEmojis) {
|
||||
if (!message || message.length === 0) {
|
||||
if (!message || message.length === 0 || (/^\s{4}/).test(message)) {
|
||||
return {isEmojiOnly: false, shouldRenderJumboEmoji: false};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,10 @@ describe('hasEmojisOnly with named emojis', () => {
|
|||
name: 'Mixed valid and invalid named emojis',
|
||||
message: ' :smile: invalid :heart: ',
|
||||
expected: {isEmojiOnly: false, shouldRenderJumboEmoji: false},
|
||||
}, {
|
||||
name: 'This should render a codeblock instead',
|
||||
message: ' :D',
|
||||
expected: {isEmojiOnly: false, shouldRenderJumboEmoji: false},
|
||||
}];
|
||||
|
||||
const customEmojis = new Map([['valid_custom', 0]]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue