feat: @mentions in comments
Parse @username in comment content, notify mentioned users (dedup against recipe-author/parent-author who are already notified via comment/reply), and render @username as a link to their profile. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
const MENTION_REGEX = /@([a-z0-9_-]{3,30})/gi;
|
||||
|
||||
export function extractMentionedUsernames(content: string): string[] {
|
||||
const matches = content.matchAll(MENTION_REGEX);
|
||||
const usernames = new Set<string>();
|
||||
for (const m of matches) {
|
||||
const username = m[1];
|
||||
if (username) usernames.add(username.toLowerCase());
|
||||
}
|
||||
return [...usernames];
|
||||
}
|
||||
Reference in New Issue
Block a user