π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix(Editor):saving-with-active-upload-preventing
Aswin Asoka4cf1d3c6a19
diff --git a/web/apps/photos/src/components/FileListWithViewer.tsx b/web/apps/photos/src/components/FileListWithViewer.tsxindex 269fd26f01..6ff278497b 100644--- a/web/apps/photos/src/components/FileListWithViewer.tsx+++ b/web/apps/photos/src/components/FileListWithViewer.tsx@@ -22,6 +22,7 @@ import { moveToTrash } from "ente-new/photos/services/collection";import type { CollectionSummary } from "ente-new/photos/services/collection-summary";import { PseudoCollectionID } from "ente-new/photos/services/collection-summary";import { updateMapEnabled } from "ente-new/photos/services/settings";+import { usePhotosAppContext } from "ente-new/photos/types/context";import { t } from "i18next";import { useCallback, useEffect, useMemo, useState } from "react";import AutoSizer from "react-virtualized-auto-sizer";@@ -216,6 +217,7 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({const { show: showMapDialog, props: mapDialogVisibilityProps } =useModalVisibility();const { onGenericError } = useBaseContext();+ const { showNotification } = usePhotosAppContext();const { mapEnabled } = useSettingsSnapshot();const { mode: colorSchemeMode, systemMode } = useColorScheme();const theme = useTheme();@@ -294,11 +296,19 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({collection: Collection,enteFile: EnteFile,) => {+ if (uploadManager.isUploadInProgress()) {+ showNotification({+ color: "critical",+ title: t("wait_for_active_upload_to_finish"),+ });+ return false;+ }uploadManager.prepareForNewUpload();uploadManager.showUploadProgressDialog();void uploadManager.uploadFile(editedFile, collection, enteFile);+ return true;};- }, [enableImageEditing]);+ }, [enableImageEditing, showNotification]);const shouldShowMapButton =modePlus !== "search" &&diff --git a/web/packages/base/components/Notification.tsx b/web/packages/base/components/Notification.tsxindex 24b4fdc0dd..5ab250d61d 100644--- a/web/packages/base/components/Notification.tsx+++ b/web/packages/base/components/Notification.tsx@@ -177,11 +177,10 @@ export const Notification: React.FC<NotificationProps> = ({sx={[(theme) => ({width: "min(320px, 100vw)",- // If the `color` of the button is a translucent one, e.g.- // "secondary", then the notification becomes opaque, which- // is not what we want. So give the entire snackbar a solid- // background color.- backgroundColor: "background.default",+ backgroundColor:+ color && color != "inherit"+ ? `${color}.main`+ : "transparent",boxShadow: theme.vars.palette.boxShadow.menu,}),...(sx ? (isSxArray(sx) ? sx : [sx]) : []),diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.jsonindex a9f7460171..e54d6ac663 100644--- a/web/packages/base/locales/en-US/translation.json+++ b/web/packages/base/locales/en-US/translation.json@@ -459,6 +459,7 @@"insufficient_storage": "Insufficient storage","insufficient_storage_hint": "These files were not uploaded as they exceed the maximum size limit for your storage plan","uploads_in_progress": "Uploads in progress",+ "wait_for_active_upload_to_finish": "Please wait for the active upload to finish.","successful_uploads": "Successful uploads","upload_to_album": "Upload to album","add_to_album": "Add to album",diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsxindex a4173e2a2d..d6e0c93f21 100644--- a/web/packages/gallery/components/viewer/FileViewer.tsx+++ b/web/packages/gallery/components/viewer/FileViewer.tsx@@ -1238,8 +1238,13 @@ export const FileViewer: React.FC<FileViewerProps> = ({collection: Collection,enteFile: EnteFile,) => {- onSaveEditedImageCopy(editedFile, collection, enteFile);- handleClose();+ const didStartSave = onSaveEditedImageCopy(+ editedFile,+ collection,+ enteFile,+ );+ if (didStartSave) handleClose();+ return didStartSave;}: undefined;}, [onSaveEditedImageCopy, handleClose]);diff --git a/web/packages/new/photos/components/ImageEditorOverlay.tsx b/web/packages/new/photos/components/ImageEditorOverlay.tsxindex a240a66dbb..bbac274abe 100644--- a/web/packages/new/photos/components/ImageEditorOverlay.tsx+++ b/web/packages/new/photos/components/ImageEditorOverlay.tsx@@ -81,7 +81,7 @@ export type ImageEditorOverlayProps = ModalVisibilityProps & {editedFile: File,collection: Collection,enteFile: EnteFile,- ) => void;+ ) => boolean;};const filterDefaultValues = {@@ -484,8 +484,9 @@ export const ImageEditorOverlay: React.FC<ImageEditorOverlayProps> = ({const collection = collections.find((c) => c.id == file.collectionID,);- onSaveEditedCopy(await getEditedFile(), collection!, file);- setFileURL(undefined);+ if (onSaveEditedCopy(await getEditedFile(), collection!, file)) {+ setFileURL(undefined);+ }} catch (e) {log.error("Error saving copy to ente", e);}