Files
fusion/packages/dashboard/app/components/mentionMatching.ts
Fusion b33b640d02 feat(FN-3809): normalize mention filtering for underscore handles
Added a `mentionMatching.ts` utility to normalize agent mention filtering across the codebase, fixing the handling of handles containing underscores. Updated `AgentMentionPopup`, `ChatView`, and `QuickChatFAB` to use the new utility, with corresponding tests added including a new `mentionMatching.te

Fusion-Task-Id: FN-3809
2026-05-09 10:31:05 -07:00

19 lines
593 B
TypeScript

export function normalizeMentionToken(value: string): string {
return value
.trim()
.toLowerCase()
.replace(/[\s-]+/g, "_")
.replace(/_+/g, "_");
}
export function matchesAgentMentionFilter(agentName: string, filter: string): boolean {
const trimmedFilter = filter.trim();
if (!trimmedFilter) {
return true;
}
const normalizedFilter = normalizeMentionToken(trimmedFilter);
const normalizedAgentName = normalizeMentionToken(agentName);
return normalizedAgentName.includes(normalizedFilter) || agentName.toLowerCase().includes(trimmedFilter.toLowerCase());
}