diff --git a/ui/src/components/IssueAttachmentsSection.test.tsx b/ui/src/components/IssueAttachmentsSection.test.tsx index 7683bee9a66..d7c67f7bf7c 100644 --- a/ui/src/components/IssueAttachmentsSection.test.tsx +++ b/ui/src/components/IssueAttachmentsSection.test.tsx @@ -116,6 +116,32 @@ describe("IssueAttachmentsSection", () => { vi.unstubAllGlobals(); }); + it("renders download-all beside upload with a direct archive link", async () => { + const attachment = makeAttachment(); + + await act(async () => { + root.render( + + Upload} + onImageClick={vi.fn()} + /> + , + ); + }); + await flushReact(); + + const downloadAll = container.querySelector( + 'a[aria-label="Download all attachments"]', + ); + expect(downloadAll?.getAttribute("href")).toBe("/api/issues/issue-1/attachments/archive"); + expect(downloadAll?.getAttribute("title")).toBe("Download all attachments"); + expect(downloadAll?.getAttribute("target")).toBeNull(); + expect(container.querySelector('button[aria-label="Upload attachment"]')).toBeTruthy(); + }); + it("renders markdown attachments with the document markdown presentation", async () => { const attachment = makeAttachment({ id: "markdown-attachment", diff --git a/ui/src/components/IssueAttachmentsSection.tsx b/ui/src/components/IssueAttachmentsSection.tsx index 0852c0c4f22..0ee7bf9b15f 100644 --- a/ui/src/components/IssueAttachmentsSection.tsx +++ b/ui/src/components/IssueAttachmentsSection.tsx @@ -22,6 +22,7 @@ import { Card } from "@/components/ui/card"; interface IssueAttachmentsSectionProps { attachments: IssueAttachment[]; + downloadAllHref?: string; uploadButton?: ReactNode; error?: string | null; dragActive?: boolean; @@ -212,6 +213,7 @@ function GenericAttachmentRow({ export function IssueAttachmentsSection({ attachments, + downloadAllHref, uploadButton, error, dragActive = false, @@ -269,7 +271,20 @@ export function IssueAttachmentsSection({

Attachments

{attachments.length} - {uploadButton} +
+ {downloadAllHref ? ( + + ) : null} + {uploadButton} +
{error && ( diff --git a/ui/src/pages/IssueDetail.tsx b/ui/src/pages/IssueDetail.tsx index 135b438c217..e50ac00d667 100644 --- a/ui/src/pages/IssueDetail.tsx +++ b/ui/src/pages/IssueDetail.tsx @@ -5124,6 +5124,7 @@ export function IssueDetail() { ) : hasAttachments ? (