Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(editor): mention projects from any editor, not only chat (MUL-9496) (#10820)

Jiayuan Zhangca516b2df5ea
diff --git a/apps/docs/content/docs/comments.fr.mdx b/apps/docs/content/docs/comments.fr.mdx
index 3da3a83066..65b62a7c58 100644
--- a/apps/docs/content/docs/comments.fr.mdx
+++ b/apps/docs/content/docs/comments.fr.mdx
@@ -98,6 +98,7 @@ Tapez `@` et choisissez une cible dans la liste :
| **Agent** | Crée une exécution pour cet agent ; les agents n'ont pas de boîte de réception. |
| **Squad** | Déclenche le chef du squad ; les membres du squad ne sont pas notifiés. |
| **Tâche** | Insère un lien vers une autre tâche — aucune notification, aucun déclenchement d'agent. |
+| **Projet** | Insère un lien vers un projet — aucune notification, aucun déclenchement d'agent. |
| **@all** | Notifie tous les membres de l'espace de travail et ne déclenche aucun agent. |
Taper `@name` en texte brut ne crée pas de mention ; choisissez dans la liste de suggestions de l'éditeur. Taper un identifiant de tâche valide le convertit automatiquement en lien vers la tâche.
diff --git a/apps/docs/content/docs/comments.ja.mdx b/apps/docs/content/docs/comments.ja.mdx
index a69f127b78..d85eb7b3ab 100644
--- a/apps/docs/content/docs/comments.ja.mdx
+++ b/apps/docs/content/docs/comments.ja.mdx
@@ -98,6 +98,7 @@ Web と Desktop では、投稿済みのコメント(自分のコメントを
| **エージェント** | そのエージェントの実行を作成します。エージェントにインボックスはありません。 |
| **スクワッド** | スクワッドのリーダーをトリガーします。スクワッドのメンバーには通知されません。 |
| **タスク** | 別のタスクへのリンクを挿入します。通知もエージェントのトリガーもありません。 |
+| **プロジェクト** | プロジェクトへのリンクを挿入します。通知もエージェントのトリガーもありません。 |
| **@all** | すべてのワークスペースメンバーに通知し、どのエージェントもトリガーしません。 |
プレーンテキストで `@name` と入力してもメンションにはなりません。エディターの候補リストから選択してください。有効なタスクキーを入力すると、エディターが自動的にタスクリンクへ変換します。
diff --git a/apps/docs/content/docs/comments.ko.mdx b/apps/docs/content/docs/comments.ko.mdx
index a1370199ec..3f659b88b7 100644
--- a/apps/docs/content/docs/comments.ko.mdx
+++ b/apps/docs/content/docs/comments.ko.mdx
@@ -98,6 +98,7 @@ Web과 Desktop에서는 게시된 댓글(본인 댓글 포함)의 텍스트를
| **에이전트** | 해당 에이전트의 실행이 생성됩니다. 에이전트에는 인박스가 없습니다. |
| **스쿼드** | 스쿼드 리더의 실행을 트리거합니다. 스쿼드 멤버에게는 알림이 가지 않습니다. |
| **태스크** | 다른 태스크의 링크를 삽입합니다. 알림을 보내거나 에이전트를 트리거하지 않습니다. |
+| **프로젝트** | 프로젝트 링크를 삽입합니다. 알림을 보내거나 에이전트를 트리거하지 않습니다. |
| **@all** | 워크스페이스의 모든 멤버에게 알립니다. 에이전트는 트리거하지 않습니다. |
일반 텍스트로 `@name`을 직접 입력하면 멘션이 만들어지지 않습니다. 편집기의 후보 목록에서 선택해야 합니다. 유효한 태스크 번호를 입력하면 편집기가 자동으로 태스크 링크로 변환합니다.
diff --git a/apps/docs/content/docs/comments.mdx b/apps/docs/content/docs/comments.mdx
index 31347f657c..24651e8ad3 100644
--- a/apps/docs/content/docs/comments.mdx
+++ b/apps/docs/content/docs/comments.mdx
@@ -98,6 +98,7 @@ Type `@` and pick a target from the list:
| **Agent** | Creates a run for that agent; agents have no inbox. |
| **Squad** | Triggers the squad leader; squad members are not notified. |
| **Issue** | Inserts a link to another issue — no notification, no agent trigger. |
+| **Project** | Inserts a link to a project — no notification, no agent trigger. |
| **@all** | Notifies every workspace member and triggers no agent. |
Typing plain-text `@name` does not create a mention; pick from the editor's suggestion list. Typing a valid issue key converts it into an issue link automatically.
diff --git a/apps/docs/content/docs/comments.zh-Hant.mdx b/apps/docs/content/docs/comments.zh-Hant.mdx
index d411ac7edd..478a8fa4f2 100644
--- a/apps/docs/content/docs/comments.zh-Hant.mdx
+++ b/apps/docs/content/docs/comments.zh-Hant.mdx
@@ -98,6 +98,7 @@ import { ResolveThreadDemo } from "@/components/demos/resolve-thread-demo";
| **AI 代理** | 為該 AI 代理建立一次執行;AI 代理沒有收件箱。 |
| **小隊** | 觸發小隊 leader 執行,不通知小隊成員。 |
| **任務** | 插入另一條任務的連結,不發通知,不觸發 AI 代理。 |
+| **專案** | 插入一個專案的連結,不發通知,不觸發 AI 代理。 |
| **@all** | 通知全部工作區成員,不觸發任何 AI 代理。 |
直接輸入純文字 `@name` 不會建立提及,需從編輯器的候選列表中選擇。輸入有效的任務編號時,編輯器會自動轉換為任務連結。
diff --git a/apps/docs/content/docs/comments.zh.mdx b/apps/docs/content/docs/comments.zh.mdx
index e2bd7ce6f4..8a2ab620a6 100644
--- a/apps/docs/content/docs/comments.zh.mdx
+++ b/apps/docs/content/docs/comments.zh.mdx
@@ -98,6 +98,7 @@ import { ResolveThreadDemo } from "@/components/demos/resolve-thread-demo";
| **智能体** | 为该智能体创建一次运行;智能体没有收件箱。 |
| **小队** | 触发小队 leader 执行,不通知小队成员。 |
| **任务** | 插入另一条任务的链接,不发通知,不触发智能体。 |
+| **项目** | 插入一个项目的链接,不发通知,不触发智能体。 |
| **@all** | 通知全部工作区成员,不触发任何智能体。 |
直接输入纯文本 `@name` 不会创建提及,需从编辑器的候选列表中选择。输入有效的任务编号时,编辑器会自动转换为任务链接。
diff --git a/packages/views/editor/extensions/mention-suggestion.test.tsx b/packages/views/editor/extensions/mention-suggestion.test.tsx
index 7f3b5406d1..1202d27d61 100644
--- a/packages/views/editor/extensions/mention-suggestion.test.tsx
+++ b/packages/views/editor/extensions/mention-suggestion.test.tsx
@@ -3,6 +3,7 @@ import { createRef, type ReactNode } from "react";
import { describe, it, expect, vi, beforeEach } from "vitest";
import { workspaceKeys } from "@multica/core/workspace/queries";
import { issueKeys, PAGINATED_CATEGORIES } from "@multica/core/issues/queries";
+import { projectKeys } from "@multica/core/projects/queries";
import { statusCategoryOfKey } from "@multica/core/issues";
import { I18nProvider } from "@multica/core/i18n/react";
import type { IssueStatusCategory, ListIssuesCache } from "@multica/core/types";
@@ -121,6 +122,7 @@ function fakeQc(data: {
leader_id: string;
}>;
issues?: Array<{ id: string; identifier: string; title: string; status: string }>;
+ projects?: Array<{ id: string; title: string; status: string; archived_at: string | null }>;
}): QueryClient {
const map = new Map<string, unknown>();
map.set(JSON.stringify(workspaceKeys.members("ws-1")), data.members ?? []);
@@ -154,6 +156,10 @@ function fakeQc(data: {
JSON.stringify(issueKeys.list("ws-1")),
{ byStatus } satisfies ListIssuesCache,
);
+ map.set(JSON.stringify(projectKeys.list("ws-1")), {
+ projects: data.projects ?? [],
+ total: data.projects?.length ?? 0,
+ });
return {
getQueryData: (key: readonly unknown[]) => map.get(JSON.stringify(key)),
getQueriesData: <T,>(filter: { queryKey: readonly unknown[] }) => {
@@ -204,6 +210,7 @@ describe("createMentionSuggestion", () => {
beforeEach(() => {
searchIssuesMock.mockReset();
searchProjectsMock.mockReset();
+ searchProjectsMock.mockResolvedValue({ projects: [], total: 0 });
Element.prototype.scrollIntoView = vi.fn();
});
@@ -343,7 +350,7 @@ describe("createMentionSuggestion", () => {
);
});
- it("loads server issue and project matches when project search is enabled", async () => {
+ it("loads server issue and project matches in the chat context picker", async () => {
searchIssuesMock.mockResolvedValue({ issues: [], total: 0 });
searchProjectsMock.mockResolvedValue({
projects: [
@@ -360,7 +367,7 @@ describe("createMentionSuggestion", () => {
render(
<I18nWrapper>
- <MentionList items={[]} query="road" command={vi.fn()} includeProjectSearch />
+ <MentionList items={[]} query="road" command={vi.fn()} contextSearch />
</I18nWrapper>,
);
@@ -371,6 +378,121 @@ describe("createMentionSuggestion", () => {
expect(searchProjectsMock).toHaveBeenCalledWith(expect.objectContaining({ q: "road", limit: 8 }));
});
+ it("offers server project matches in their own section outside chat", async () => {
+ searchIssuesMock.mockResolvedValue({
+ issues: [{ id: "i-1", identifier: "MUL-1", title: "Road test", status: "todo" }],
+ total: 1,
+ });
+ searchProjectsMock.mockResolvedValue({
+ projects: [{ id: "p-roadmap", title: "Roadmap", description: null, icon: null, status: "planned" }],
+ total: 1,
+ });
+
+ render(<I18nWrapper><MentionList items={[]} query="road" command={vi.fn()} /></I18nWrapper>);
+
+ await waitFor(() => {
+ expect(screen.getByText("Roadmap")).toBeInTheDocument();
+ });
+ const headings = Array.from(document.querySelectorAll<HTMLElement>("div.uppercase")).map(
+ (el) => el.textContent,
+ );
+ expect(headings).toEqual(["Issues", "Projects"]);
+ expect(searchIssuesMock).toHaveBeenCalledWith(expect.objectContaining({ q: "road", limit: 20 }));
+ expect(searchProjectsMock).toHaveBeenCalledWith(
+ expect.objectContaining({ q: "road", limit: 8, include_archived: true }),
+ );
+ });
+
+ it("keeps project rows visible when issue matches alone would fill the list", async () => {
+ searchProjectsMock.mockResolvedValue({
+ projects: [{ id: "p-roadmap", title: "Roadmap", description: null, icon: null, status: "planned" }],
+ total: 1,
+ });
+ searchIssuesMock.mockResolvedValue({ issues: [], total: 0 });
+ const items: MentionItem[] = Array.from({ length: 25 }, (_, n) => ({
+ id: `i-${n}`,
+ label: `MUL-${n}`,
+ type: "issue" as const,
+ description: `road ${n}`,
+ status: "todo" as const,
+ }));
+
+ render(<I18nWrapper><MentionList items={items} query="road" command={vi.fn()} /></I18nWrapper>);
+
+ await waitFor(() => {
+ expect(screen.getByText("Roadmap")).toBeInTheDocument();
+ });
+ expect(document.querySelectorAll("button")).toHaveLength(20);
+ });
+
+ it("keeps the selected issue when a late project result takes a reserved slot", async () => {
+ let resolveProjects!: (value: unknown) => void;
+ searchProjectsMock.mockReturnValue(new Promise((resolve) => { resolveProjects = resolve; }));
+ searchIssuesMock.mockResolvedValue({ issues: [], total: 0 });
+ const items: MentionItem[] = Array.from({ length: 20 }, (_, n) => ({
+ id: `i-${n}`,
+ label: `MUL-${n}`,
+ type: "issue" as const,
+ description: `road ${n}`,
+ status: "todo" as const,
+ }));
+ const command = vi.fn<(item: MentionItem) => void>();
+ const ref = createRef<MentionListRef>();
+
+ render(
+ <I18nWrapper>
+ <MentionList ref={ref} items={items} query="road" command={command} />
+ </I18nWrapper>,
+ );
+ act(() => {
+ ref.current!.onKeyDown({ event: new KeyboardEvent("keydown", { key: "ArrowUp" }) });
+ });
+ await waitFor(() => expect(searchProjectsMock).toHaveBeenCalled());
+ await act(async () => {
+ resolveProjects({
+ projects: [{ id: "p-roadmap", title: "Roadmap", description: null, icon: null, status: "planned" }],
+ total: 1,
+ });
+ });
+ await waitFor(() => {
+ expect(screen.getByText("Roadmap")).toBeInTheDocument();
+ });
+ act(() => {
+ ref.current!.onKeyDown({ event: new KeyboardEvent("keydown", { key: "Enter" }) });
+ });
+
+ expect(command).toHaveBeenCalledWith(expect.objectContaining({ id: "i-19" }));
+ });
+
+ it("keeps server issue matches when the project search fails", async () => {
+ searchIssuesMock.mockResolvedValue({
+ issues: [{ id: "i-7", identifier: "MUL-7", title: "Road test", status: "todo" }],
+ total: 1,
+ });
+ searchProjectsMock.mockRejectedValue(new Error("503"));
+
+ render(<I18nWrapper><MentionList items={[]} query="road" command={vi.fn()} /></I18nWrapper>);
+
+ await waitFor(() => {
+ expect(screen.getByText("MUL-7")).toBeInTheDocument();
+ });
+ expect(screen.queryByText("No results")).not.toBeInTheDocument();
+ });
+
+ it("matches cached live projects synchronously and leaves archived ones to the server", () => {
+ const qc = fakeQc({
+ projects: [
+ { id: "p-live", title: "Roadmap", status: "planned", archived_at: null },
+ { id: "p-old", title: "Roadmap 2024", status: "completed", archived_at: "2025-01-01T00:00:00Z" },
+ { id: "p-other", title: "Hiring", status: "planned", archived_at: null },
+ ],
+ });
+
+ const items = createMentionSuggestion(qc).items!(itemArgs("road")) as MentionItem[];
+
+ expect(items.filter((i) => i.type === "project").map((i) => i.id)).toEqual(["p-live"]);
+ });
+
it("does not call searchIssues for an empty query", () => {
render(<I18nWrapper><MentionList items={[]} query="" command={vi.fn()} /></I18nWrapper>);
@@ -463,7 +585,7 @@ describe("createMentionSuggestion", () => {
render(
<I18nWrapper>
- <MentionList ref={ref} items={items} query="" command={command} includeProjectSearch />
+ <MentionList ref={ref} items={items} query="" command={command} contextSearch />
</I18nWrapper>,
);
@@ -1048,7 +1170,7 @@ describe("MentionList cancelled demotion", () => {
render(
<I18nWrapper>
- <MentionList items={items} query="" command={vi.fn()} includeProjectSearch />
+ <MentionList items={items} query="" command={vi.fn()} contextSearch />
</I18nWrapper>,
);
@@ -1126,7 +1248,7 @@ describe("MentionList cancelled demotion", () => {
render(
<I18nWrapper>
- <MentionList items={[]} query="thing" command={vi.fn()} includeProjectSearch />
+ <MentionList items={[]} query="thing" command={vi.fn()} contextSearch />
</I18nWrapper>,
);
@@ -1155,7 +1277,7 @@ describe("MentionList cancelled demotion", () => {
render(
<I18nWrapper>
- <MentionList items={[]} query="thing" command={vi.fn()} includeProjectSearch />
+ <MentionList items={[]} query="thing" command={vi.fn()} contextSearch />
</I18nWrapper>,
);
@@ -1188,7 +1310,7 @@ describe("MentionList cancelled demotion", () => {
render(
<I18nWrapper>
- <MentionList items={items} query="" command={vi.fn()} includeProjectSearch />
+ <MentionList items={items} query="" command={vi.fn()} contextSearch />
</I18nWrapper>,
);
@@ -1215,7 +1337,7 @@ describe("MentionList cancelled demotion", () => {
render(
<I18nWrapper>
- <MentionList items={items} query="" command={vi.fn()} includeProjectSearch />
+ <MentionList items={items} query="" command={vi.fn()} contextSearch />
</I18nWrapper>,
);
@@ -1293,7 +1415,7 @@ describe("MentionList cancelled demotion", () => {
render(
<I18nWrapper>
- <MentionList items={[]} query="Search revamp" command={vi.fn()} includeProjectSearch />
+ <MentionList items={[]} query="Search revamp" command={vi.fn()} contextSearch />
</I18nWrapper>,
);
diff --git a/packages/views/editor/extensions/mention-suggestion.tsx b/packages/views/editor/extensions/mention-suggestion.tsx
index 9678d88dc1..742af68ea8 100644
--- a/packages/views/editor/extensions/mention-suggestion.tsx
+++ b/packages/views/editor/extensions/mention-suggestion.tsx
@@ -16,6 +16,7 @@ import { flattenIssueBuckets, issueKeys } from "@multica/core/issues/queries";
import { issueStatusCategory } from "@multica/core/issues";
import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
import { workspaceKeys } from "@multica/core/workspace/queries";
+import { projectKeys } from "@multica/core/projects/queries";
import { useAuthStore } from "@multica/core/auth";
import { canAssignAgentToIssue } from "@multica/core/permissions";
import { isAgentRuntimeBound } from "@multica/core/agents";
@@ -29,6 +30,7 @@ import { isMentionBoundaryAfter } from "@multica/core/markdown";
import type {
Issue,
ListIssuesCache,
+ ListProjectsResponse,
MemberWithUser,
Agent,
Squad,
@@ -100,7 +102,8 @@ interface MentionListProps {
items: MentionItem[];
query: string;
command: (item: MentionItem) => void;
- includeProjectSearch?: boolean;
+ /** Chat context picker: fewer server issues, all server matches under "Search". */
+ contextSearch?: boolean;
}
export interface MentionListRef {
@@ -120,6 +123,7 @@ function groupItems(items: MentionItem[], query: string): MentionGroup[] {
const search: MentionItem[] = [];
const users: MentionItem[] = [];
const issues: MentionItem[] = [];
+ const projects: MentionItem[] = [];
const cancelled: MentionItem[] = [];
for (const item of items) {
@@ -131,8 +135,10 @@ function groupItems(items: MentionItem[], query: string): MentionGroup[] {
recent.push(item);
} else if (item.group === "search") {
search.push(item);
- } else if (item.type === "issue" || item.type === "project") {
+ } else if (item.type === "issue") {
issues.push(item);
+ } else if (item.type === "project") {
+ projects.push(item);
} else {
users.push(item);
}
@@ -144,6 +150,7 @@ function groupItems(items: MentionItem[], query: string): MentionGroup[] {
if (search.length > 0) groups.push({ label: "Search", items: search });
if (users.length > 0) groups.push({ label: "Users", items: users });
if (issues.length > 0) groups.push({ label: "Issues", items: issues });
+ if (projects.length > 0) groups.push({ label: "Projects", items: projects });
// Always last: no cancelled row of any type may precede a live one.
if (cancelled.length > 0) groups.push({ label: "Cancelled", items: cancelled });
return groups;
@@ -152,8 +159,10 @@ function groupItems(items: MentionItem[], query: string): MentionGroup[] {
// MentionList — the popup rendered inside the editor
const MAX_ITEMS = 20;
+const RESERVED_PROJECT_SLOTS = 5;
const SERVER_ISSUE_SEARCH_LIMIT = 20;
const SERVER_CONTEXT_SEARCH_LIMIT = 8;
+const SERVER_PROJECT_SEARCH_LIMIT = 8;
const SERVER_SEARCH_DEBOUNCE_MS = 150;
function mentionItemKey(item: MentionItem): string {
@@ -259,8 +268,39 @@ function demoteCancelledItems(items: MentionItem[], query: string): MentionItem[
: items;
}
+/**
+ * Cuts the list to MAX_ITEMS without letting issues crowd out projects. Issue
+ * matches (cached plus server) merge ahead of project matches and alone can
+ * fill every slot, so the first few live projects keep a slot regardless of
+ * position. Cancelled projects get no reservation: they never take a live
+ * row's slot. The row the user has selected always stays, so a late project
+ * result cannot pull it out from under the highlight and make Enter insert a
+ * different row. Order is preserved.
+ */
+function truncateMentionItems(
+ items: MentionItem[],
+ query: string,
+ selectedKey: string | null,
+): MentionItem[] {
+ if (items.length <= MAX_ITEMS) return items;
+ const kept = new Set(
+ items
+ .filter((item) => item.type === "project" && !isDemotedCancelled(item, query))
+ .slice(0, RESERVED_PROJECT_SLOTS),
+ );
+ const selected = items.find((item) => mentionItemKey(item) === selectedKey);
+ if (selected) kept.add(selected);
+ let remaining = MAX_ITEMS - kept.size;
+ return items.filter((item) => {
+ if (kept.has(item)) return true;
+ if (remaining <= 0) return false;
+ remaining--;
+ return true;
+ });
+}
+
export const MentionList = forwardRef<MentionListRef, MentionListProps>(
- function MentionList({ items, query, command, includeProjectSearch = false }, ref) {
+ function MentionList({ items, query, command, contextSearch = false }, ref) {
const { t } = useT("editor");
const { colorOf: statusColorOf, iconOf: statusIconOf } = useIssueStatuses(getCurrentWsId() ?? "");
// Selection is tracked by item identity, NOT by a positional index. The
@@ -301,41 +341,35 @@ export const MentionList = forwardRef<MentionListRef, MentionListProps>(
const timer = setTimeout(() => {
void (async () => {
try {
- if (includeProjectSearch) {
- const [issues, projects] = await Promise.all([
- searchIssues({
- q,
- limit: SERVER_CONTEXT_SEARCH_LIMIT,
- include_closed: true,
- signal: controller.signal,
- }),
- searchProjects({
- q,
- limit: SERVER_CONTEXT_SEARCH_LIMIT,
- include_closed: true,
- include_archived: true,
- signal: controller.signal,
- }),
- ]);
- if (!cancelled && !controller.signal.aborted) {
- setServerItems([
- ...issues.issues.map((issue) => ({ ...issueToMention(issue), group: "search" as const })),
- ...projects.projects.map((project) => ({ ...projectToMention(project), group: "search" as const })),
- ]);
- }
- } else {
- const res = await searchIssues({
+ // One search failing must not discard the other's results.
+ const [issues, projects] = await Promise.allSettled([
+ searchIssues({
+ q,
+ limit: contextSearch ? SERVER_CONTEXT_SEARCH_LIMIT : SERVER_ISSUE_SEARCH_LIMIT,
+ include_closed: true,
+ signal: controller.signal,
+ }),
+ searchProjects({
q,
- limit: SERVER_ISSUE_SEARCH_LIMIT,
+ limit: SERVER_PROJECT_SEARCH_LIMIT,
include_closed: true,
+ include_archived: true,
signal: controller.signal,
- });
- if (!cancelled && !controller.signal.aborted) {
- setServerItems(res.issues.map(issueToMention));
- }
+ }),
+ ]);
+ if (!cancelled && !controller.signal.aborted) {
+ const results = [
+ ...(issues.status === "fulfilled" ? issues.value.issues.map(issueToMention) : []),
+ ...(projects.status === "fulfilled" ? projects.value.projects.map(projectToMention) : []),
+ ];
+ setServerItems(
+ contextSearch
+ ? results.map((item) => ({ ...item, group: "search" as const }))
+ : results,
+ );
}
} catch {
- // Aborted or network error: keep the synchronous cache results.
+ // Malformed response: keep the synchronous cache results.
} finally {
if (!cancelled && !controller.signal.aborted) {
setSearchedQuery(q);
@@ -350,15 +384,19 @@ export const MentionList = forwardRef<MentionListRef, MentionListProps>(
clearTimeout(timer);
controller.abort();
};
- }, [includeProjectSearch, normalizedQuery]);
+ }, [contextSearch, normalizedQuery]);
const displayItems = useMemo(() => {
const currentServerItems = searchedQuery === normalizedQuery ? serverItems : [];
- return demoteCancelledItems(
- mergeMentionItems(items, currentServerItems),
+ return truncateMentionItems(
+ demoteCancelledItems(
+ mergeMentionItems(items, currentServerItems),
+ normalizedQuery,
+ ),
normalizedQuery,
- ).slice(0, MAX_ITEMS);
- }, [items, normalizedQuery, searchedQuery, serverItems]);
+ selectedKey,
+ );
+ }, [items, normalizedQuery, searchedQuery, selectedKey, serverItems]);
// The single index space for selection. groupItems() re-buckets displayItems
// (current → recent → search → users → issues); orderedItems is exactly what
@@ -467,6 +505,7 @@ export const MentionList = forwardRef<MentionListRef, MentionListProps>(
if (label === "Search") return t(($) => $.mention.group_search);
if (label === "Users") return t(($) => $.mention.group_users);
if (label === "Issues") return t(($) => $.mention.group_issues);
+ if (label === "Projects") return t(($) => $.mention.group_projects);
if (label === "Cancelled") return t(($) => $.mention.group_cancelled);
return label;
};
@@ -843,7 +882,18 @@ export function createMentionSuggestion(
)
.map(issueToMention);
- return [...allItem, ...userItems, ...issueItems];
+ // Archived projects are left to the server search, which ranks them last.
+ const cachedProjects =
+ qc.getQueryData<ListProjectsResponse>(projectKeys.list(wsId))?.projects ?? [];
+ const projectItems: MentionItem[] = cachedProjects
+ .filter(
+ (p) =>
+ !p.archived_at &&
+ (p.title.toLowerCase().includes(q) || matchesPinyin(p.title, q)),
+ )
+ .map(projectToMention);
+
+ return [...allItem, ...userItems, ...issueItems, ...projectItems];
}
return {
@@ -875,7 +925,7 @@ export function createMentionSuggestion(
items: props.items,
query: props.query,
command: props.command,
- includeProjectSearch: options.mode === "context",
+ contextSearch: options.mode === "context",
}),
onKeyDown: (ref, props) => ref?.onKeyDown(props) ?? false,
}),
diff --git a/packages/views/locales/en/editor.json b/packages/views/locales/en/editor.json
index d8b35819e1..c630c5e7bf 100644
--- a/packages/views/locales/en/editor.json
+++ b/packages/views/locales/en/editor.json
@@ -106,6 +106,7 @@
"mention": {
"group_users": "Users",
"group_issues": "Issues",
+ "group_projects": "Projects",
"all_members": "All members",
"agent_badge": "Agent",
"squad_badge": "Squad",
diff --git a/packages/views/locales/es/editor.json b/packages/views/locales/es/editor.json
index ba4303180b..b54f12bdc1 100644
--- a/packages/views/locales/es/editor.json
+++ b/packages/views/locales/es/editor.json
@@ -106,6 +106,7 @@
"mention": {
"group_users": "Usuarios",
"group_issues": "Tareas",
+ "group_projects": "Proyectos",
"all_members": "Todos los miembros",
"agent_badge": "Agente",
"squad_badge": "Squad",
diff --git a/packages/views/locales/fr/editor.json b/packages/views/locales/fr/editor.json
index a633673e7e..ecd9ec0fb3 100644
--- a/packages/views/locales/fr/editor.json
+++ b/packages/views/locales/fr/editor.json
@@ -106,6 +106,7 @@
"mention": {
"group_users": "Utilisateurs",
"group_issues": "Tâches",
+ "group_projects": "Projets",
"all_members": "Tous les membres",
"agent_badge": "Agent",
"squad_badge": "Squad",
diff --git a/packages/views/locales/ja/editor.json b/packages/views/locales/ja/editor.json
index 6265f45d79..43b4e291df 100644
--- a/packages/views/locales/ja/editor.json
+++ b/packages/views/locales/ja/editor.json
@@ -102,6 +102,7 @@
"mention": {
"group_users": "ユーザー",
"group_issues": "タスク",
+ "group_projects": "プロジェクト",
"all_members": "すべてのメンバー",
"agent_badge": "エージェント",
"squad_badge": "スクワッド",
diff --git a/packages/views/locales/ko/editor.json b/packages/views/locales/ko/editor.json
index b913156446..ae5c2df847 100644
--- a/packages/views/locales/ko/editor.json
+++ b/packages/views/locales/ko/editor.json
@@ -102,6 +102,7 @@
"mention": {
"group_users": "사용자",
"group_issues": "태스크",
+ "group_projects": "프로젝트",
"all_members": "모든 멤버",
"agent_badge": "에이전트",
"squad_badge": "스쿼드",
diff --git a/packages/views/locales/ru/editor.json b/packages/views/locales/ru/editor.json
index bf637b9ec8..190f5318a4 100644
--- a/packages/views/locales/ru/editor.json
+++ b/packages/views/locales/ru/editor.json
@@ -114,6 +114,7 @@
"mention": {
"group_users": "Пользователи",
"group_issues": "Задачи",
+ "group_projects": "Проекты",
"all_members": "Все участники",
"agent_badge": "Агент",
"squad_badge": "Команда",
diff --git a/packages/views/locales/zh-Hans/editor.json b/packages/views/locales/zh-Hans/editor.json
index 604f4c736b..a005177ac5 100644
--- a/packages/views/locales/zh-Hans/editor.json
+++ b/packages/views/locales/zh-Hans/editor.json
@@ -102,6 +102,7 @@
"mention": {
"group_users": "用户",
"group_issues": "任务",
+ "group_projects": "项目",
"all_members": "所有成员",
"agent_badge": "智能体",
"squad_badge": "小队",
diff --git a/packages/views/locales/zh-Hant/editor.json b/packages/views/locales/zh-Hant/editor.json
index 01d0d94553..04c0ba7c37 100644
--- a/packages/views/locales/zh-Hant/editor.json
+++ b/packages/views/locales/zh-Hant/editor.json
@@ -102,6 +102,7 @@
"mention": {
"group_users": "使用者",
"group_issues": "任務",
+ "group_projects": "專案",
"all_members": "所有成員",
"agent_badge": "AI 代理",
"squad_badge": "小隊",