minor: Refactor `user_mention_re` to match characters except `>`.

The regex could have match a bunch of characters including `>`
and hence end up matching across multiple adjacent spans in
a weird way. This commit fixes such an issue.
This commit is contained in:
akshatdalton 2021-05-19 19:58:15 +00:00 committed by Tim Abbott
parent 5bab65e82f
commit e50d189191
1 changed files with 1 additions and 1 deletions

View File

@ -218,7 +218,7 @@ export function apply_markdown(message) {
},
silencedMentionHandler(quote) {
// Silence quoted mentions.
const user_mention_re = /<span.*user-mention.*data-user-id="(\d+|\*)"[^>]*>@/gm;
const user_mention_re = /<span[^>]*user-mention[^>]*data-user-id="(\d+|\*)"[^>]*>@/gm;
quote = quote.replace(user_mention_re, (match) => {
match = match.replace(/"user-mention"/g, '"user-mention silent"');
match = match.replace(/>@/g, ">");