forked from Ivasoft/mattermost-mobile
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:
@@ -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]]);
|
||||
|
||||
Reference in New Issue
Block a user