Files
Arnaud a144052e46 feat: @mention autocomplete in comment composer
Typing "@" + 2+ characters now opens a dropdown of matching users
(reusing the existing people-search endpoint), with arrow-key/Enter/
Tab selection and click-to-select. Consolidated the previously
duplicated MENTION_REGEX (client display vs. server extraction) into
a single export from lib/mentions.ts.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-13 22:00:10 +02:00

12 lines
360 B
TypeScript

export 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];
}