Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web] Keep gallery delete action availability unchanged

Aswin Asok0e2321a32582
diff --git a/web/apps/photos/src/components/FileList.tsx b/web/apps/photos/src/components/FileList.tsx
index e7c1349586..cbbd0cd132 100644
--- a/web/apps/photos/src/components/FileList.tsx
+++ b/web/apps/photos/src/components/FileList.tsx
@@ -484,18 +484,15 @@ export const FileList: React.FC<FileListProps> = ({
previousSelectionRef.current !== null;
let selectionCount: number;
let favoriteCount: number;
- let hasOwnFiles: boolean;
let hasOnlyOwnFiles: boolean;
if (isTemporarySingleSelection) {
selectionCount = 1;
favoriteCount = favoriteFileIDs?.has(contextMenu.file.id) ? 1 : 0;
hasOnlyOwnFiles = contextMenu.file.ownerID === user?.id;
- hasOwnFiles = hasOnlyOwnFiles;
} else {
selectionCount = selected.count;
favoriteCount = selectedFavoriteCount;
- hasOwnFiles = selected.ownCount > 0;
hasOnlyOwnFiles =
selectionCount > 0 && selected.ownCount === selectionCount;
}
@@ -503,7 +500,6 @@ export const FileList: React.FC<FileListProps> = ({
barMode: mode,
isInSearchMode: modePlus === "search",
collectionSummary,
- hasOwnFiles,
hasOnlyOwnFiles,
showAddPerson: !!showAddPersonAction,
showEditLocation: !!showEditLocationAction && hasOnlyOwnFiles,
diff --git a/web/apps/photos/src/components/SelectedFileOptions.tsx b/web/apps/photos/src/components/SelectedFileOptions.tsx
index f4e31004b4..b963fd3e74 100644
--- a/web/apps/photos/src/components/SelectedFileOptions.tsx
+++ b/web/apps/photos/src/components/SelectedFileOptions.tsx
@@ -217,7 +217,6 @@ export const SelectedFileOptions: React.FC<SelectedFileOptionsProps> = ({
barMode,
isInSearchMode,
collectionSummary,
- hasOwnFiles: selectedOwnFileCount > 0,
hasOnlyOwnFiles,
showAddPerson: !!onShowAssignPersonDialog,
showEditLocation: !!onEditLocation && hasOnlyOwnFiles,
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index f76eca7c04..d884ed5a1f 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -1569,7 +1569,6 @@ const Page: React.FC = () => {
const selectedOwnCount = selected.ownCount;
const handleDeleteFiles = useCallback(
(suppressSelectionBar = false) => {
- if (selectedOwnCount === 0) return;
setTrashFilesDialog({
count: selectedOwnCount,
onConfirm: createFileOpHandler("trash", {
diff --git a/web/apps/photos/src/utils/file-actions.ts b/web/apps/photos/src/utils/file-actions.ts
index 0941d84aad..a971b08a8c 100644
--- a/web/apps/photos/src/utils/file-actions.ts
+++ b/web/apps/photos/src/utils/file-actions.ts
@@ -27,7 +27,6 @@ interface FileActionContext {
barMode?: GalleryBarMode;
isInSearchMode: boolean;
collectionSummary: CollectionSummary | undefined;
- hasOwnFiles: boolean;
hasOnlyOwnFiles: boolean;
showAddPerson: boolean;
showEditLocation: boolean;
@@ -40,7 +39,6 @@ export function getAvailableFileActions(
barMode,
isInSearchMode,
collectionSummary,
- hasOwnFiles,
hasOnlyOwnFiles,
showAddPerson,
showEditLocation,
@@ -62,9 +60,7 @@ export function getAvailableFileActions(
insertAddPersonBeforeModifications(actions);
}
- return hasOwnFiles
- ? actions
- : actions.filter((action) => action !== "trash");
+ return actions;
}
function getBaseActions(
diff --git a/web/apps/photos/tests/file-actions.test.ts b/web/apps/photos/tests/file-actions.test.ts
index d9b78812e1..9deb9e7157 100644
--- a/web/apps/photos/tests/file-actions.test.ts
+++ b/web/apps/photos/tests/file-actions.test.ts
@@ -9,7 +9,6 @@ describe("getAvailableFileActions", () => {
barMode: "hidden-albums",
isInSearchMode: false,
collectionSummary: undefined,
- hasOwnFiles: true,
hasOnlyOwnFiles: true,
showAddPerson: false,
showEditLocation: false,
@@ -30,21 +29,6 @@ describe("getAvailableFileActions", () => {
barMode: "hidden-albums",
isInSearchMode: false,
collectionSummary: undefined,
- hasOwnFiles: false,
- hasOnlyOwnFiles: false,
- showAddPerson: false,
- showEditLocation: false,
- }),
- ).toEqual(["download", "addToAlbum", "unhide"]);
- });
-
- test("allows trashing owned files in a mixed hidden-album selection", () => {
- expect(
- getAvailableFileActions({
- barMode: "hidden-albums",
- isInSearchMode: false,
- collectionSummary: undefined,
- hasOwnFiles: true,
hasOnlyOwnFiles: false,
showAddPerson: false,
showEditLocation: false,
@@ -73,7 +57,6 @@ describe("getAvailableFileActions", () => {
getAvailableFileActions({
isInSearchMode: false,
collectionSummary,
- hasOwnFiles: false,
hasOnlyOwnFiles: false,
showAddPerson: false,
showEditLocation: false,