From cf01f6813abe95251dd52647ee997cce8348922f Mon Sep 17 00:00:00 2001 From: Soroush Baraouf Date: Sat, 28 Nov 2026 01:31:20 -0500 Subject: [PATCH 1/2] test(web): cover the comment audience after a customer reply A Jira Service Management comment posted as a reply to the customer leaves the composer on "Reply to customer", so the next comment also reaches the customer. This fails on main. Co-Authored-By: Claude Opus 5.5 --- .../issue/IssueDetailPanel.browser.test.tsx | 59 ++++++++++++++++++- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/issue/IssueDetailPanel.browser.test.tsx b/apps/web/src/components/issue/IssueDetailPanel.browser.test.tsx index fc9ef8266f3af..8157252f98e08 100644 --- a/apps/web/src/components/issue/IssueDetailPanel.browser.test.tsx +++ b/apps/web/src/components/issue/IssueDetailPanel.browser.test.tsx @@ -53,14 +53,41 @@ const detail = vi.hoisted(() => ({ linkedPullRequests: [], })) as unknown as IssueDetail; -const state = vi.hoisted(() => ({ openLink: vi.fn(async () => {}) })); +const state = vi.hoisted(() => ({ + openLink: vi.fn(async () => {}), + comment: vi.fn(async (_value: unknown) => ({ _tag: "Success" })), +})); vi.mock(import("~/browser/useOpenLink"), () => ({ useOpenLink: () => state.openLink })); +vi.mock(import("~/state/use-atom-command"), async (original) => { + const actual = await original(); + const { issueEnvironment } = await import("~/state/issues"); + return { + useAtomCommand: ((command, options) => + command.label === issueEnvironment.comment.label + ? state.comment + : actual.useAtomCommand(command, options)) as typeof actual.useAtomCommand, + }; +}); vi.mock(import("./IssueThreadLinks"), () => ({ IssueThreadLinks: (() => null) as never })); vi.mock(import("~/state/issues"), async (original) => { const { Atom } = await import("effect/reactivity"); const actual = await original(); const detailAtom = Atom.make(AsyncResult.success(detail)); + const serviceDeskAtom = Atom.make( + AsyncResult.success({ + ...detail, + tracker: "jira", + host: "example.atlassian.net", + scope: "SUP", + key: "SUP-12", + displayKey: "SUP-12", + url: "https://example.atlassian.net/browse/SUP-12", + capabilities: { ...detail.capabilities, comment: true }, + viewerPermissions: { ...detail.viewerPermissions, comment: true }, + commentAudiences: true, + }), + ); const candidatesAtom = Atom.make( AsyncResult.success({ labels: [ @@ -79,7 +106,8 @@ vi.mock(import("~/state/issues"), async (original) => { ...actual, issueEnvironment: { ...actual.issueEnvironment, - detail: (() => detailAtom) as never, + detail: (({ input }: { input: { key: string } }) => + input.key === "SUP-12" ? serviceDeskAtom : detailAtom) as never, candidates: (() => candidatesAtom) as never, comment: { ...actual.issueEnvironment.comment, permissionAtom: () => allowed }, }, @@ -197,4 +225,31 @@ describe("IssueDetailPanel", () => { await expect.element(page.getByRole("option", { name: "alice" })).toBeInTheDocument(); await expect.element(page.getByRole("option", { name: "bob" })).not.toBeInTheDocument(); }); + + it("goes back to an internal note after a reply to the customer is posted", async () => { + state.comment.mockClear(); + await using _screen = await render( + , + ); + const field = page.getByRole("textbox", { name: "Add a comment" }); + const send = page.getByRole("button", { name: "Comment", exact: true }); + + await page.getByRole("button", { name: "Internal note" }).click(); + await page.getByRole("menuitemradio", { name: "Reply to customer" }).click(); + await userEvent.fill(field, "We have shipped a fix."); + await send.click(); + await expect.element(page.getByRole("button", { name: "Internal note" })).toBeInTheDocument(); + await userEvent.fill(field, "Customer confirmed on a call."); + await send.click(); + await vi.waitFor(() => + expect( + state.comment.mock.calls.map( + ([value]) => (value as { input: { audience?: string } }).input.audience, + ), + ).toEqual(["public", "internal"]), + ); + }); }); From 92edacc88e051d19c2cafda082b98de86cf07ba1 Mon Sep 17 00:00:00 2001 From: Soroush Baraouf Date: Sat, 28 Nov 2026 01:34:20 -0500 Subject: [PATCH 2/2] fix(web,mobile): the comment after a customer reply is an internal note again On a Jira Service Management issue both comment composers start on "Internal note", but a successful post only cleared the text, so the audience stayed on "Reply to customer" and the next comment also went to the customer. A successful post now resets the audience to internal in the web and mobile composers. A failed post keeps the draft and the chosen audience. Co-Authored-By: Claude Opus 5.5 --- apps/mobile/src/features/issues/IssueCommentComposer.tsx | 1 + apps/web/src/components/issue/IssueCommentComposer.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/apps/mobile/src/features/issues/IssueCommentComposer.tsx b/apps/mobile/src/features/issues/IssueCommentComposer.tsx index b6e31687f8ce4..c48935f1d5a41 100644 --- a/apps/mobile/src/features/issues/IssueCommentComposer.tsx +++ b/apps/mobile/src/features/issues/IssueCommentComposer.tsx @@ -107,6 +107,7 @@ export function IssueCommentComposer(props: { const submitted = latestDraft.current; if (submitted.trim().length === 0) return; const sent = await props.onSubmit(submitted, props.audiences ? audience : undefined); + if (sent) setAudience("internal"); if (sent && latestDraft.current === submitted) changeDraft(""); }; const send = () => { diff --git a/apps/web/src/components/issue/IssueCommentComposer.tsx b/apps/web/src/components/issue/IssueCommentComposer.tsx index c92c85a891c62..ae5b805d39a77 100644 --- a/apps/web/src/components/issue/IssueCommentComposer.tsx +++ b/apps/web/src/components/issue/IssueCommentComposer.tsx @@ -79,6 +79,7 @@ export function IssueCommentComposer({ return; } setBody(""); + changeAudience("internal"); }; const submitAfterDictation = () => speech.submitAfterDictation((text) => void submit(text)); const submitDisabled =