Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[web][photos] Add dialog before removing others photo

Neeraj Gupta062e749f7ce6
diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.json
index 3ad9216767..8b372a5875 100644
--- a/web/packages/base/locales/en-US/translation.json
+++ b/web/packages/base/locales/en-US/translation.json
@@ -375,6 +375,7 @@
"remove": "Remove",
"yes_remove": "Yes, remove",
"remove_from_album": "Remove from album",
+ "remove_from_album_others_message": "Selected photos will not be accessible to any viewer of this album, except the photo owners.",
"move_to_trash": "Move to trash",
"trash_files_message": "Selected files will be removed from all albums and moved to trash.",
"trash_file_message": "The file will be removed from all albums and moved to trash.",
diff --git a/web/packages/new/photos/components/SelectedFileOptions.tsx b/web/packages/new/photos/components/SelectedFileOptions.tsx
index fb86c0b920..081235a9ba 100644
--- a/web/packages/new/photos/components/SelectedFileOptions.tsx
+++ b/web/packages/new/photos/components/SelectedFileOptions.tsx
@@ -205,25 +205,59 @@ export const SelectedFileOptions: React.FC<SelectedFileOptionsProps> = ({
onSelectCollection: createOnSelectForCollectionOp("add"),
});
+ const isSharedIncoming =
+ collectionSummary?.attributes.has("sharedIncoming");
+ const isSharedOutgoing =
+ collectionSummary?.attributes.has("sharedOutgoing");
+ const isRemovingOthers = selectedFileCount != selectedOwnFileCount;
+
const handleRemoveFromCollection = () => {
- const remove = () => onRemoveFilesFromCollection(collection!);
+ if (!collection) return;
+ const remove = () => onRemoveFilesFromCollection(collection);
+
+ if (isSharedIncoming) {
+ if (isRemovingOthers) {
+ showMiniDialog({
+ title: t("remove_from_album"),
+ message: t("remove_from_album_others_message"),
+ continue: {
+ text: t("remove"),
+ color: "critical",
+ action: remove,
+ },
+ cancel: t("cancel"),
+ });
+ } else {
+ remove();
+ }
+ return;
+ }
- if (collectionSummary?.attributes.has("sharedIncoming")) {
- remove();
- } else {
- const onlyUserFiles = selectedFileCount == selectedOwnFileCount;
+ if (isSharedOutgoing && isRemovingOthers) {
showMiniDialog({
title: t("remove_from_album"),
- message: onlyUserFiles
- ? t("confirm_remove_message")
- : t("confirm_remove_incl_others_message"),
+ message: t("remove_from_album_others_message"),
continue: {
- text: t("yes_remove"),
- color: onlyUserFiles ? "primary" : "critical",
+ text: t("remove"),
+ color: "critical",
action: remove,
},
});
+ return;
}
+
+ const onlyUserFiles = !isRemovingOthers;
+ showMiniDialog({
+ title: t("remove_from_album"),
+ message: onlyUserFiles
+ ? t("confirm_remove_message")
+ : t("confirm_remove_incl_others_message"),
+ continue: {
+ text: t("yes_remove"),
+ color: onlyUserFiles ? "primary" : "critical",
+ action: remove,
+ },
+ });
};
const handleMoveToCollection = () => {