diff --git a/web/apps/photos/src/components/ExportModal.tsx b/web/apps/photos/src/components/ExportModal.tsx index 56ba64cd12..8bb9bdfc27 100644 --- a/web/apps/photos/src/components/ExportModal.tsx +++ b/web/apps/photos/src/components/ExportModal.tsx @@ -49,6 +49,7 @@ export default function ExportModal(props: Props) { }); const [pendingExports, setPendingExports] = useState([]); const [lastExportTime, setLastExportTime] = useState(0); + const [includeShared, setIncludeShared] = useState(false); // ==================== // SIDE EFFECTS @@ -68,6 +69,7 @@ export default function ExportModal(props: Props) { exportService.getExportSettings(); setExportFolder(exportSettings?.folder ?? null); setContinuousExport(exportSettings?.continuousExport ?? false); + setIncludeShared(exportSettings?.includeShared ?? false); void syncExportRecord(exportSettings?.folder); } catch (e) { log.error("export on mount useEffect failed", e); @@ -145,6 +147,20 @@ export default function ExportModal(props: Props) { setContinuousExport(newContinuousExport); }; + const toggleIncludeShared = async () => { + const newIncludeShared = !includeShared; + exportService.updateExportSettings({ + includeShared: newIncludeShared, + }); + setIncludeShared(newIncludeShared); + + const exportRecord = + await exportService.getExportRecord(exportFolder); + const pendingExports = + await exportService.getPendingExports(exportRecord); + setPendingExports(pendingExports); + }; + const startExport = async (opts?: ExportOpts) => { if (!(await verifyExportFolderExists())) return; @@ -171,6 +187,11 @@ export default function ExportModal(props: Props) { changeExportDirectory={handleChangeExportDirectoryClick} exportStage={exportStage} /> + + {t("INCLUDE_SHARED")} + + + + + ); + + default: + return <>; + } +} + const ExportDynamicContent = ({ exportStage, startExport, diff --git a/web/apps/photos/src/services/export/index.ts b/web/apps/photos/src/services/export/index.ts index a130f9f729..c865c749fa 100644 --- a/web/apps/photos/src/services/export/index.ts +++ b/web/apps/photos/src/services/export/index.ts @@ -222,7 +222,9 @@ class ExportService { collection.owner.id, ]), ); - const userPersonalFiles = getPersonalFiles( + + const includeShared = this.getExportSettings()?.includeShared; + const userPersonalFiles = includeShared ? files : getPersonalFiles( files, user, collectionIdToOwnerIDMap, @@ -348,7 +350,9 @@ class ExportService { collection.owner.id, ]), ); - const personalFiles = getPersonalFiles( + + const includeShared = this.getExportSettings()?.includeShared; + const personalFiles = includeShared ? files : getPersonalFiles( files, user, collectionIdToOwnerIDMap, diff --git a/web/apps/photos/src/types/export/index.ts b/web/apps/photos/src/types/export/index.ts index 6767c3e869..e83e0eb2fb 100644 --- a/web/apps/photos/src/types/export/index.ts +++ b/web/apps/photos/src/types/export/index.ts @@ -57,6 +57,7 @@ export interface ExportRecord { export interface ExportSettings { folder: string; continuousExport: boolean; + includeShared: boolean; } export interface ExportUIUpdaters { diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.json index e6a4be1012..51c87ef632 100644 --- a/web/packages/base/locales/en-US/translation.json +++ b/web/packages/base/locales/en-US/translation.json @@ -532,6 +532,7 @@ "CONTINUOUS_EXPORT": "Sync continuously", "PENDING_ITEMS": "Pending items", "EXPORT_STARTING": "Export starting...", + "INCLUDE_SHARED": "Include shared files", "delete_account_reason_label": "What is the main reason you are deleting your account?", "delete_account_reason_placeholder": "Select a reason", "delete_reason": {