summaryrefslogtreecommitdiffstats
path: root/web/react/utils/text_formatting.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/utils/text_formatting.jsx')
-rw-r--r--web/react/utils/text_formatting.jsx14
1 files changed, 7 insertions, 7 deletions
diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx
index 9fd22e6b9..c49bdf916 100644
--- a/web/react/utils/text_formatting.jsx
+++ b/web/react/utils/text_formatting.jsx
@@ -148,23 +148,23 @@ function autolinkAtMentions(text, tokens) {
function replaceAtMentionWithToken(fullMatch, prefix, mention, username) {
let usernameLower = username.toLowerCase();
-
+
if (mentionExists(usernameLower)) {
// Exact match
const alias = addToken(usernameLower, mention, '');
return prefix + alias;
- }
+ }
// Not an exact match, attempt to truncate any punctuation to see if we can find a user
const originalUsername = usernameLower;
-
+
for (let c = usernameLower.length; c > 0; c--) {
- if (isPunctuation(usernameLower[c-1])) {
- usernameLower = usernameLower.substring(0, c);
+ if (isPunctuation(usernameLower[c - 1])) {
+ usernameLower = usernameLower.substring(0, c - 1);
if (mentionExists(usernameLower)) {
- const extraText = originalUsername.substr(c);
- const alias = addToken(usernameLower, mention, extraText);
+ const extraText = originalUsername.substr(c - 1);
+ const alias = addToken(usernameLower, '@' + usernameLower, extraText);
return prefix + alias;
}
} else {