mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 22:09:16 +01:00
fix(api): 🐛 Fix duplicated mentions, general refactorings
This commit is contained in:
parent
84a0a07ea6
commit
e293bd280d
5 changed files with 29 additions and 29 deletions
|
|
@ -298,20 +298,17 @@ export const replaceTextMentions = (text: string, mentions: User[]): string => {
|
|||
);
|
||||
}
|
||||
|
||||
return finalText
|
||||
.replace(
|
||||
createRegExp(
|
||||
return finalText.replace(
|
||||
createRegExp(
|
||||
exactly(
|
||||
exactly(`@${username}`)
|
||||
.notBefore(anyOf(letter, digit, charIn("@")))
|
||||
.notAfter(anyOf(letter, digit, charIn("@"))),
|
||||
[global],
|
||||
),
|
||||
linkTemplate(`@${username}@${baseHost}`),
|
||||
)
|
||||
.replaceAll(
|
||||
`@${username}@${baseHost}`,
|
||||
linkTemplate(`@${username}@${baseHost}`),
|
||||
);
|
||||
).or(exactly(`@${username}@${baseHost}`)),
|
||||
[global],
|
||||
),
|
||||
linkTemplate(`@${username}@${baseHost}`),
|
||||
);
|
||||
}, text);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue