summaryrefslogtreecommitdiffstats
path: root/web/react
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-11-06 11:30:25 -0500
committerhmhealey <harrisonmhealey@gmail.com>2015-11-06 11:30:25 -0500
commit95569ff03fb09673996be280137783014d023779 (patch)
treeb3d30d7ca3d3db4f69513d0c643bd0ae1ba314ed /web/react
parent0d1fe806a06df9a0fcc97694d0c9e96835bbfb0b (diff)
downloadchat-95569ff03fb09673996be280137783014d023779.tar.gz
chat-95569ff03fb09673996be280137783014d023779.tar.bz2
chat-95569ff03fb09673996be280137783014d023779.zip
Removed required whitespace from before @mentions
Diffstat (limited to 'web/react')
-rw-r--r--web/react/utils/text_formatting.jsx8
1 files changed, 4 insertions, 4 deletions
diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx
index ac26107cc..705d85cf6 100644
--- a/web/react/utils/text_formatting.jsx
+++ b/web/react/utils/text_formatting.jsx
@@ -135,13 +135,13 @@ function autolinkAtMentions(text, tokens) {
return alias;
}
- function replaceAtMentionWithToken(fullMatch, prefix, mention, username) {
+ function replaceAtMentionWithToken(fullMatch, mention, username) {
let usernameLower = username.toLowerCase();
if (mentionExists(usernameLower)) {
// Exact match
const alias = addToken(usernameLower, mention, '');
- return prefix + alias;
+ return alias;
}
// Not an exact match, attempt to truncate any punctuation to see if we can find a user
@@ -154,7 +154,7 @@ function autolinkAtMentions(text, tokens) {
if (mentionExists(usernameLower)) {
const extraText = originalUsername.substr(c - 1);
const alias = addToken(usernameLower, '@' + usernameLower, extraText);
- return prefix + alias;
+ return alias;
}
} else {
// If the last character is not punctuation, no point in going any further
@@ -166,7 +166,7 @@ function autolinkAtMentions(text, tokens) {
}
let output = text;
- output = output.replace(/(^|[^a-z0-9])(@([a-z0-9.\-_]*))/gi, replaceAtMentionWithToken);
+ output = output.replace(/(@([a-z0-9.\-_]*))/gi, replaceAtMentionWithToken);
return output;
}