Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(search): fold/unfold all comments on identifier URLs (#8842)
Vladimir Babinf1560daff380
diff --git a/packages/views/search/search-command.test.tsx b/packages/views/search/search-command.test.tsxindex bd3a026835..50bb39633d 100644--- a/packages/views/search/search-command.test.tsx+++ b/packages/views/search/search-command.test.tsx@@ -256,7 +256,7 @@ function resolveIssue(key: readonly unknown[]) {// issueDetailOptions key shape: ["issues", wsId, "detail", id]if (key[0] === "issues" && key[2] === "detail") {const id = key[3];- return mockAllIssues.current.find((i) => i.id === id);+ return mockAllIssues.current.find((i) => i.id === id || i.identifier === id);}return undefined;}@@ -706,6 +706,31 @@ describe("SearchCommand", () => {expect(useSearchStore.getState().open).toBe(false);});+ it("folds comments under the issue UUID when the URL carries the identifier", async () => {+ const user = userEvent.setup();+ mockPathname.current = "/ws-test/issues/MUL-42";+ mockAllIssues.current = [+ { id: "issue-1", identifier: "MUL-42", title: "Demo", status: "todo" },+ ];+ mockTimeline.current = [+ { type: "comment", id: "root-1", actor_type: "member", actor_id: "u1", created_at: "2026-01-01T01:00:00Z", parent_id: null },+ ];+ renderSearch();++ const input = screen.getByPlaceholderText("Type a command or search...");+ await user.type(input, "fold");++ const foldItem = await screen.findByText(+ (_, el) => el?.textContent === "Fold All Comments" && el?.tagName === "SPAN",+ );+ await user.click(foldItem);++ await waitFor(() => {+ expect(mockCommentCollapseAll).toHaveBeenCalledWith("issue-1", ["root-1"]);+ });+ expect(mockResolvedCollapseAll).toHaveBeenCalledWith("issue-1");+ });+it("unfolds all comments and expands resolved threads", async () => {const user = userEvent.setup();mockPathname.current = "/ws-test/issues/issue-1";diff --git a/packages/views/search/search-command.tsx b/packages/views/search/search-command.tsxindex acf2f644f4..a6545f6f0c 100644--- a/packages/views/search/search-command.tsx+++ b/packages/views/search/search-command.tsx@@ -430,7 +430,7 @@ export function SearchCommand() {];if (currentIssueId && currentIssue) {- const identifier = currentIssue.identifier;+ const { id: issueId, identifier } = currentIssue;items.push({key: "copy-issue-link",@@ -467,12 +467,12 @@ export function SearchCommand() {// still can't load, no comments are on screen — dropping the// action matches the visible state.void queryClient- .ensureQueryData(issueTimelineOptions(currentIssueId))+ .ensureQueryData(issueTimelineOptions(issueId)).then((entries) => {useCommentCollapseStore.getState()- .collapseAll(currentIssueId, rootCommentIds(entries));- useResolvedExpandStore.getState().collapseAll(currentIssueId);+ .collapseAll(issueId, rootCommentIds(entries));+ useResolvedExpandStore.getState().collapseAll(issueId);}).catch(() => {});setOpen(false);@@ -485,12 +485,12 @@ export function SearchCommand() {keywords: ["unfold", "expand", "comments", "展开", "评论"],onSelect: () => {void queryClient- .ensureQueryData(issueTimelineOptions(currentIssueId))+ .ensureQueryData(issueTimelineOptions(issueId)).then((entries) => {- useCommentCollapseStore.getState().expandAll(currentIssueId);+ useCommentCollapseStore.getState().expandAll(issueId);useResolvedExpandStore.getState()- .expandAll(currentIssueId, resolvedThreadRootIds(entries));+ .expandAll(issueId, resolvedThreadRootIds(entries));}).catch(() => {});setOpen(false);