From 399865923658319d6d12a7719bc3b5554218bbad Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Fri, 4 Aug 2017 14:03:41 -0400 Subject: PLT-7267 Refactored tracking of recent emojis to hide deleted emojis (#7102) * Fixed local ESLint error * PLT-7267 Refactored tracking of recent emojis to hide deleted emojis --- webapp/utils/emoticons.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'webapp/utils/emoticons.jsx') diff --git a/webapp/utils/emoticons.jsx b/webapp/utils/emoticons.jsx index b13b50a77..8a10e254e 100644 --- a/webapp/utils/emoticons.jsx +++ b/webapp/utils/emoticons.jsx @@ -26,6 +26,8 @@ export const emoticonPatterns = { thumbsdown: /(^|\s)(:-1:)(?=$|\s)/g // :-1: }; +export const EMOJI_PATTERN = /(:([a-zA-Z0-9_-]+):)/g; + export function handleEmoticons(text, tokens, emojis) { let output = text; @@ -49,7 +51,7 @@ export function handleEmoticons(text, tokens, emojis) { } // match named emoticons like :goat: - output = output.replace(/(:([a-zA-Z0-9_-]+):)/g, (fullMatch, matchText, name) => replaceEmoticonWithToken(fullMatch, '', matchText, name)); + output = output.replace(EMOJI_PATTERN, (fullMatch, matchText, name) => replaceEmoticonWithToken(fullMatch, '', matchText, name)); // match text smilies like :D for (const name of Object.keys(emoticonPatterns)) { -- cgit v1.2.3-1-g7c22