Fix issue with username highlighting

This commit is contained in:
Phillip Thelen
2018-11-27 13:20:45 +01:00
parent 0271d98b91
commit f65240c217
2 changed files with 10 additions and 3 deletions

View File

@@ -15,7 +15,7 @@ export async function highlightMentions (text) {
.exec();
members.forEach((member) => {
const username = member.auth.local.username;
text = text.replace(new RegExp(`@${username}\\b`, 'g'), `[@${username}](/members/${member._id})`);
text = text.replace(new RegExp(`@${username}(?![\\-\\w])`, 'g'), `[@${username}](/profile/${member._id})`);
});
}
return text;