diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-03-14 11:23:39 -0400 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-03-17 10:33:06 -0400 |
commit | f8ac97fb22a73d8d5d8f8974357fccd0f15e06bb (patch) | |
tree | 36622dadf5dc6466ae56b261e48d5a2e6c85740e /webapp/utils | |
parent | 927c2dbfecaad12f28d294fe9575b660d19293b9 (diff) | |
download | chat-f8ac97fb22a73d8d5d8f8974357fccd0f15e06bb.tar.gz chat-f8ac97fb22a73d8d5d8f8974357fccd0f15e06bb.tar.bz2 chat-f8ac97fb22a73d8d5d8f8974357fccd0f15e06bb.zip |
Changed mention parser to ignore empty string mentions
Diffstat (limited to 'webapp/utils')
-rw-r--r-- | webapp/utils/text_formatting.jsx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx index 9833b995c..4c8b5e24c 100644 --- a/webapp/utils/text_formatting.jsx +++ b/webapp/utils/text_formatting.jsx @@ -213,6 +213,11 @@ function highlightCurrentMentions(text, tokens) { } for (const mention of UserStore.getCurrentMentionKeys()) { + // occasionally we get an empty mention which matches a bunch of empty strings + if (!mention) { + continue; + } + output = output.replace(new RegExp(`(^|\\W)(${escapeRegex(mention)})\\b`, 'gi'), replaceCurrentMentionWithToken); } |