[GH-5915] Clicking on @mention of a user in a post shows the profile popover (#6129)

* post message at-mention profile pop-over

* remove hover effect to special mentions

* make non-clickable the non-existing at-mention username

* fix "video call" position

* use usernameMap instead of initially defined liteUsernameMap

* update per comments
Этот коммит содержится в:
Saturnino Abril
2017-05-01 23:08:54 +09:00
коммит произвёл Harrison Healey
родитель 597641545d
Коммит 83f819451a
20 изменённых файлов: 281 добавлений и 102 удалений

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

@@ -166,8 +166,13 @@ 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: `<a class='mention-link' href='#' data-mention='${username}'>${mention}</a>`,
value: tokenValue,
originalText: mention
});
return alias;
@@ -181,8 +186,7 @@ export function autolinkAtMentions(text, tokens, usernameMap) {
const truncated = usernameLower.substring(0, c);
const suffix = usernameLower.substring(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])) {
if (mentionExists(truncated) && (c === usernameLower.length || punctuation.test(usernameLower[c]))) {
const alias = addToken(truncated, '@' + truncated);
return prefix + alias + suffix;
}