diff options
author | Joram Wilander <jwawilander@gmail.com> | 2015-11-06 12:40:05 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2015-11-06 12:40:05 -0500 |
commit | e5b9fb6b95d988c222ddb85ae5e9ae4d4399864a (patch) | |
tree | 6796e9a7880404e2e60fa93b21d14b5cf045acbb /web/react/utils/text_formatting.jsx | |
parent | ed2537c4b54dfa7b5feeabf6a12124a540011001 (diff) | |
parent | 95569ff03fb09673996be280137783014d023779 (diff) | |
download | chat-e5b9fb6b95d988c222ddb85ae5e9ae4d4399864a.tar.gz chat-e5b9fb6b95d988c222ddb85ae5e9ae4d4399864a.tar.bz2 chat-e5b9fb6b95d988c222ddb85ae5e9ae4d4399864a.zip |
Merge pull request #1342 from hmhealey/plt761
PLT-761 Removed required whitespace from before @mentions
Diffstat (limited to 'web/react/utils/text_formatting.jsx')
-rw-r--r-- | web/react/utils/text_formatting.jsx | 8 |
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; } |