diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2017-08-04 14:03:41 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-08-04 11:03:41 -0700 |
commit | 399865923658319d6d12a7719bc3b5554218bbad (patch) | |
tree | 4e1d3d8dcd196a33b8b9daf03c1dc659c1025384 /webapp/utils | |
parent | 2c8a5ffd971f00648e7bc5f48993fc187f3179f2 (diff) | |
download | chat-399865923658319d6d12a7719bc3b5554218bbad.tar.gz chat-399865923658319d6d12a7719bc3b5554218bbad.tar.bz2 chat-399865923658319d6d12a7719bc3b5554218bbad.zip |
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
Diffstat (limited to 'webapp/utils')
-rw-r--r-- | webapp/utils/emoticons.jsx | 4 |
1 files changed, 3 insertions, 1 deletions
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)) { |