summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-03-17 10:33:28 -0400
committerHarrison Healey <harrisonmhealey@gmail.com>2016-03-17 10:33:28 -0400
commitd42459729c6015b07c2f0d872a44212e93bccb39 (patch)
tree36622dadf5dc6466ae56b261e48d5a2e6c85740e
parent927c2dbfecaad12f28d294fe9575b660d19293b9 (diff)
parentf8ac97fb22a73d8d5d8f8974357fccd0f15e06bb (diff)
downloadchat-d42459729c6015b07c2f0d872a44212e93bccb39.tar.gz
chat-d42459729c6015b07c2f0d872a44212e93bccb39.tar.bz2
chat-d42459729c6015b07c2f0d872a44212e93bccb39.zip
Merge pull request #2424 from hmhealey/escape
Changed mention parser to ignore empty string mentions
-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);
}