mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Hotfix: correct issues from PRs rollout (#10993)
* fix(various): correct issues from PRs rollout 1. Send Gems modal opens from profiles again 2. Contributor titles appear on hover again 3. Tags dropdown in tasks appears again 4. Only user's own @mentions get highlighted again * fix(test): correct order of css classes in expect
This commit is contained in:
@@ -9,15 +9,14 @@ const finalMentionRegEx = new RegExp(`${optionalAnchorTagRegExStr}${mentionRegEx
|
||||
export function highlightUsers (text, userName, displayName) {
|
||||
const currentUser = [`@${userName}`, `@${displayName}`].map(escapeRegExp);
|
||||
|
||||
|
||||
text = text.replace(finalMentionRegEx, (fullMatched, preMention, mentionStr, postMention) => {
|
||||
if (preMention && preMention.includes('<a') || Boolean(postMention)) {
|
||||
return fullMatched;
|
||||
}
|
||||
|
||||
const isUserMention = currentUser.includes(mentionStr) ? 'at-text' : '';
|
||||
const isUserMention = currentUser.includes(mentionStr) ? 'at-highlight' : '';
|
||||
|
||||
return fullMatched.replace(mentionStr, `<span class="at-highlight ${isUserMention}">${mentionStr}</span>`);
|
||||
return fullMatched.replace(mentionStr, `<span class="at-text ${isUserMention}">${mentionStr}</span>`);
|
||||
});
|
||||
|
||||
return text;
|
||||
|
||||
Reference in New Issue
Block a user