feat: server-side mentionable filter for @mentions
This commit is contained in:
parent
f82a89c2f9
commit
e7529306ac
@ -24,16 +24,13 @@ export default function MentionInput({ projectId, value, onChange, onSubmit, onM
|
||||
// Load members once
|
||||
useEffect(() => {
|
||||
if (!projectId) return;
|
||||
getProjectMembers(projectId).then(setMembers).catch(() => {});
|
||||
getProjectMembers(projectId, { mentionable: true }).then(setMembers).catch(() => {});
|
||||
}, [projectId]);
|
||||
|
||||
const filtered = members.filter((m) => {
|
||||
// Скрываем не-mentionable (bridge, system agents)
|
||||
if (m.agent_config?.mentionable === false) return false;
|
||||
if (m.type === "bridge") return false;
|
||||
return m.name.toLowerCase().includes(filter.toLowerCase()) ||
|
||||
m.slug.toLowerCase().includes(filter.toLowerCase());
|
||||
});
|
||||
const filtered = members.filter((m) =>
|
||||
m.name.toLowerCase().includes(filter.toLowerCase()) ||
|
||||
m.slug.toLowerCase().includes(filter.toLowerCase())
|
||||
);
|
||||
|
||||
const insertMention = useCallback((member: ProjectMember) => {
|
||||
if (mentionStart < 0) return;
|
||||
|
||||
@ -430,8 +430,11 @@ export function getAttachmentUrl(attachmentId: string): string {
|
||||
|
||||
// --- Project Members ---
|
||||
|
||||
export async function getProjectMembers(projectId: string): Promise<ProjectMember[]> {
|
||||
return request(`/api/v1/projects/${projectId}/members`);
|
||||
export async function getProjectMembers(projectId: string, opts?: { mentionable?: boolean }): Promise<ProjectMember[]> {
|
||||
const params = new URLSearchParams();
|
||||
if (opts?.mentionable !== undefined) params.set("mentionable", String(opts.mentionable));
|
||||
const qs = params.toString();
|
||||
return request(`/api/v1/projects/${projectId}/members${qs ? `?${qs}` : ""}`);
|
||||
}
|
||||
|
||||
export async function addProjectMember(projectId: string, memberId: string): Promise<{ ok: boolean }> {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user