summaryrefslogtreecommitdiffstats
path: root/webapp/utils/text_formatting.jsx
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-05-01 17:40:54 -0400
committerJoram Wilander <jwawilander@gmail.com>2017-05-01 17:40:54 -0400
commit581bd8637fa860fa26f60d8089c5d6e3f613d23f (patch)
treeb0ba799af7f873b460e45f5e6057b357be0e8047 /webapp/utils/text_formatting.jsx
parent935405f19d4a0d78f1a84964460635ec5a091e0c (diff)
downloadchat-581bd8637fa860fa26f60d8089c5d6e3f613d23f.tar.gz
chat-581bd8637fa860fa26f60d8089c5d6e3f613d23f.tar.bz2
chat-581bd8637fa860fa26f60d8089c5d6e3f613d23f.zip
Revert "[GH-5915] Clicking on @mention of a user in a post shows the profile popover (#6129)" (#6289)
This reverts commit 83f819451a80a767170b927eb2f0d5ed63f03239.
Diffstat (limited to 'webapp/utils/text_formatting.jsx')
-rw-r--r--webapp/utils/text_formatting.jsx10
1 files changed, 3 insertions, 7 deletions
diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx
index bd718b363..c2c71a4e1 100644
--- a/webapp/utils/text_formatting.jsx
+++ b/webapp/utils/text_formatting.jsx
@@ -166,13 +166,8 @@ export function autolinkAtMentions(text, tokens, usernameMap) {
const index = tokens.size;
const alias = `$MM_ATMENTION${index}`;
- let tokenValue = `<span data-mention='${username}'><a class='mention-link' href='#'>${mention}</a></span>`;
- if (Constants.SPECIAL_MENTIONS.indexOf(username) >= 0) {
- tokenValue = mention;
- }
-
tokens.set(alias, {
- value: tokenValue,
+ value: `<a class='mention-link' href='#' data-mention='${username}'>${mention}</a>`,
originalText: mention
});
return alias;
@@ -186,7 +181,8 @@ export function autolinkAtMentions(text, tokens, usernameMap) {
const truncated = usernameLower.substring(0, c);
const suffix = usernameLower.substring(c);
- if (mentionExists(truncated) && (c === usernameLower.length || punctuation.test(usernameLower[c]))) {
+ // If we've found a username or run out of punctuation to trim off, render it as an at mention
+ if (mentionExists(truncated) || !punctuation.test(truncated[truncated.length - 1])) {
const alias = addToken(truncated, '@' + truncated);
return prefix + alias + suffix;
}