Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(file-actions):move-hidden-on-owned-availablity

Aswin Asok5881c5fb4e8b
diff --git a/web/apps/photos/src/utils/file-actions.ts b/web/apps/photos/src/utils/file-actions.ts
index ca0efc9747..a971b08a8c 100644
--- a/web/apps/photos/src/utils/file-actions.ts
+++ b/web/apps/photos/src/utils/file-actions.ts
@@ -127,7 +127,12 @@ function getBaseActions(
}
if (barMode === "hidden-albums") {
- return ["download", "addToAlbum", "moveToAlbum", "unhide", "trash"];
+ const actions: FileContextAction[] = ["download", "addToAlbum"];
+ if (hasOnlyOwnFiles) {
+ actions.push("moveToAlbum");
+ }
+ actions.push("unhide", "trash");
+ return actions;
}
const isUserFavorites =
diff --git a/web/apps/photos/tests/file-actions.test.ts b/web/apps/photos/tests/file-actions.test.ts
index 46178dd4a1..9deb9e7157 100644
--- a/web/apps/photos/tests/file-actions.test.ts
+++ b/web/apps/photos/tests/file-actions.test.ts
@@ -23,6 +23,19 @@ describe("getAvailableFileActions", () => {
]);
});
+ test("does not allow moving unowned files between hidden albums", () => {
+ expect(
+ getAvailableFileActions({
+ barMode: "hidden-albums",
+ isInSearchMode: false,
+ collectionSummary: undefined,
+ hasOnlyOwnFiles: false,
+ showAddPerson: false,
+ showEditLocation: false,
+ }),
+ ).toEqual(["download", "addToAlbum", "unhide", "trash"]);
+ });
+
test("uses shared actions for an incoming uncategorized collection", () => {
const collectionSummary: CollectionSummary = {
id: 1,