Removed required whitespace from before @mentions

Этот коммит содержится в:
hmhealey
2015-11-06 11:30:25 -05:00
родитель 0d1fe806a0
Коммит 95569ff03f

Просмотреть файл

@@ -135,13 +135,13 @@ function autolinkAtMentions(text, tokens) {
return alias; return alias;
} }
function replaceAtMentionWithToken(fullMatch, prefix, mention, username) { function replaceAtMentionWithToken(fullMatch, mention, username) {
let usernameLower = username.toLowerCase(); let usernameLower = username.toLowerCase();
if (mentionExists(usernameLower)) { if (mentionExists(usernameLower)) {
// Exact match // Exact match
const alias = addToken(usernameLower, mention, ''); 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 // 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)) { if (mentionExists(usernameLower)) {
const extraText = originalUsername.substr(c - 1); const extraText = originalUsername.substr(c - 1);
const alias = addToken(usernameLower, '@' + usernameLower, extraText); const alias = addToken(usernameLower, '@' + usernameLower, extraText);
return prefix + alias; return alias;
} }
} else { } else {
// If the last character is not punctuation, no point in going any further // If the last character is not punctuation, no point in going any further
@@ -166,7 +166,7 @@ function autolinkAtMentions(text, tokens) {
} }
let output = text; let output = text;
output = output.replace(/(^|[^a-z0-9])(@([a-z0-9.\-_]*))/gi, replaceAtMentionWithToken); output = output.replace(/(@([a-z0-9.\-_]*))/gi, replaceAtMentionWithToken);
return output; return output;
} }