summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-03-14 11:23:39 -0400
committerHarrison Healey <harrisonmhealey@gmail.com>2016-03-17 10:33:06 -0400
commitf8ac97fb22a73d8d5d8f8974357fccd0f15e06bb (patch)
tree36622dadf5dc6466ae56b261e48d5a2e6c85740e /webapp
parent927c2dbfecaad12f28d294fe9575b660d19293b9 (diff)
downloadchat-f8ac97fb22a73d8d5d8f8974357fccd0f15e06bb.tar.gz
chat-f8ac97fb22a73d8d5d8f8974357fccd0f15e06bb.tar.bz2
chat-f8ac97fb22a73d8d5d8f8974357fccd0f15e06bb.zip
Changed mention parser to ignore empty string mentions
Diffstat (limited to 'webapp')
-rw-r--r--webapp/utils/text_formatting.jsx5
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);
}