summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-03-07 17:16:14 -0500
committerChristopher Speller <crspeller@gmail.com>2016-03-07 17:16:14 -0500
commit9d5e3e65b8423ddc144c8250357eb5ec1783587d (patch)
tree74bcb6fecd98dc26e88c3683a573b59a79896d78 /web
parentededd620bbcfc5d64223d061361dd00407c79fc4 (diff)
parent969595608387c61c7eb370961348d07835902a32 (diff)
downloadchat-9d5e3e65b8423ddc144c8250357eb5ec1783587d.tar.gz
chat-9d5e3e65b8423ddc144c8250357eb5ec1783587d.tar.bz2
chat-9d5e3e65b8423ddc144c8250357eb5ec1783587d.zip
Merge pull request #2352 from hmhealey/plt2139
PLT-2139 Stopped removing extra punctuation after @mentions
Diffstat (limited to 'web')
-rw-r--r--web/react/utils/text_formatting.jsx13
1 files changed, 6 insertions, 7 deletions
diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx
index dae2252a6..a930e9ece 100644
--- a/web/react/utils/text_formatting.jsx
+++ b/web/react/utils/text_formatting.jsx
@@ -123,14 +123,13 @@ function autolinkAtMentions(text, tokens) {
return (Constants.SPECIAL_MENTIONS.indexOf(u) !== -1 || UserStore.getProfileByUsername(u));
}
- function addToken(username, mention, extraText) {
+ function addToken(username, mention) {
const index = tokens.size;
const alias = `MM_ATMENTION${index}`;
tokens.set(alias, {
value: `<a class='mention-link' href='#' data-mention='${username}'>${mention}</a>`,
- originalText: mention,
- extraText
+ originalText: mention
});
return alias;
}
@@ -152,9 +151,9 @@ function autolinkAtMentions(text, tokens) {
usernameLower = usernameLower.substring(0, c - 1);
if (mentionExists(usernameLower)) {
- const extraText = originalUsername.substr(c - 1);
- const alias = addToken(usernameLower, '@' + usernameLower, extraText);
- return alias;
+ const suffix = originalUsername.substr(c - 1);
+ const alias = addToken(usernameLower, '@' + usernameLower);
+ return alias + suffix;
}
} else {
// If the last character is not punctuation, no point in going any further
@@ -188,7 +187,7 @@ function highlightCurrentMentions(text, tokens) {
const newAlias = `MM_SELFMENTION${index}`;
newTokens.set(newAlias, {
- value: `<span class='mention-highlight'>${alias}</span>` + (token.extraText || ''),
+ value: `<span class='mention-highlight'>${alias}</span>`,
originalText: token.originalText
});
output = output.replace(alias, newAlias);