From 1e22718cc24a7c4cf9441a451de92208d84458e7 Mon Sep 17 00:00:00 2001 From: Akhileshwar Shriram <112577383+AkhilTheBoss@users.noreply.github.com> Date: Wed, 24 Dec 2025 23:24:43 +0530 Subject: [PATCH] feat: allow Bulk Download from Commons View --- client/src/api.ts | 4 +- .../components/FilesManager/FilesManager.tsx | 56 ++++++++------ client/src/screens/commons/Project/index.tsx | 1 + server/api.js | 4 +- server/api/projectfiles.ts | 76 ++++++++----------- server/api/validators/projectfiles.ts | 1 - 6 files changed, 69 insertions(+), 73 deletions(-) diff --git a/client/src/api.ts b/client/src/api.ts index 763c008a..aab3d448 100644 --- a/client/src/api.ts +++ b/client/src/api.ts @@ -1518,8 +1518,7 @@ class API { async bulkDownloadFiles( projectID: string, - fileIDs: string[], - emailToNotify: string + fileIDs: string[] ) { const arrQuery = fileIDs.map((id) => `fileID=${id}`).join(`&`); const res = await axios.get<{ file?: string } & ConductorBaseResponse>( @@ -1527,7 +1526,6 @@ class API { { params: { fileIDs: arrQuery, - emailToNotify, }, } ); diff --git a/client/src/components/FilesManager/FilesManager.tsx b/client/src/components/FilesManager/FilesManager.tsx index 44cfa6ba..dac14494 100644 --- a/client/src/components/FilesManager/FilesManager.tsx +++ b/client/src/components/FilesManager/FilesManager.tsx @@ -51,6 +51,7 @@ interface FilesManagerProps extends SegmentProps { projectID: string; toggleFilesManager: () => void; canViewDetails: boolean; + allowBulkDownload?: boolean; projectHasDefaultLicense?: boolean; projectVisibility?: string; } @@ -66,6 +67,7 @@ const FilesManager: React.FC = ({ projectID, toggleFilesManager, canViewDetails = false, + allowBulkDownload = false, projectHasDefaultLicense = false, projectVisibility = "private", }) => { @@ -438,7 +440,7 @@ const FilesManager: React.FC = ({ async function handleBulkDownload(ids: string[]) { try { setDownloadLoading(true); - const res = await api.bulkDownloadFiles(projectID, ids, user.email); + const res = await api.bulkDownloadFiles(projectID, ids); if (!res.data || res.data.err) { throw new Error("Unable to download files. Please try again later."); @@ -705,12 +707,14 @@ const FilesManager: React.FC = ({ )} - {canViewDetails && ( + {(canViewDetails || allowBulkDownload) && ( -

- If your project has supporting files, use this tool to upload and - organize them. -

+ {canViewDetails && ( +

+ If your project has supporting files, use this tool to upload and + organize them. +

+ )} = ({ : "" } > - - + {canViewDetails && ( + <> + + + + )} {itemsChecked > 1 && ( )} - {itemsChecked > 1 && ( + {canViewDetails && itemsChecked > 1 && ( )} - {itemsChecked > 0 && ( + {canViewDetails && itemsChecked > 0 && ( )} - {canBulkTag && ( + {canViewDetails && canBulkTag && ( )} - {itemsChecked > 1 && ( + {canViewDetails && itemsChecked > 1 && (