From 9de0ceb22995d9bdf9b53d620471f1dd9d8042ae Mon Sep 17 00:00:00 2001
From: Girish S <girish.sonawane@gmail.com>
Date: Fri, 23 Oct 2015 10:47:26 +0530
Subject: auto-link mentions with user names having symbols

this also handles the case where user_name having '_'
---
 web/react/utils/text_formatting.jsx | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'web/react/utils/text_formatting.jsx')

diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx
index 4b6d87254..9f1a5a53f 100644
--- a/web/react/utils/text_formatting.jsx
+++ b/web/react/utils/text_formatting.jsx
@@ -47,8 +47,8 @@ export function doFormatText(text, options) {
     const tokens = new Map();
 
     // replace important words and phrases with tokens
-    output = autolinkUrls(output, tokens);
     output = autolinkAtMentions(output, tokens);
+    output = autolinkUrls(output, tokens);
     output = autolinkHashtags(output, tokens);
 
     if (!('emoticons' in options) || options.emoticon) {
@@ -78,6 +78,13 @@ export function doFormatEmoticons(text) {
     return output;
 }
 
+export function doFormatMentions(text) {
+    const tokens = new Map();
+    let output = autolinkAtMentions(text, tokens);
+    output = replaceTokens(output, tokens);
+    return output;
+}
+
 export function sanitizeHtml(text) {
     let output = text;
 
@@ -188,6 +195,7 @@ function autolinkAtMentions(text, tokens) {
 
     let output = text;
     output = output.replace(/(^|\s)(@([a-z0-9.\-_]*))/gi, replaceAtMentionWithToken);
+
     return output;
 }
 
-- 
cgit v1.2.3-1-g7c22

