fix: skip inaccessible album grants in global search

This commit is contained in:
Leon Tonhäuser committed 2026-11-30 16:42:10 +01:00
1 parent abe072b2d1
commit bdf6399b35
2 files changed
+17 -1

No files matched your search

+14
View File
@@ -112,6 +112,20 @@ test("moves the queried granted album to the active gallery context without losi
]);
});
test("global search keeps hits when a granted album is no longer visible in Immich", async () => {
const { catalog, immich } = createCatalog({ grantedAlbumIds: ["allowed", "missing"] });
immich.searchPhotos.mockImplementation(async ({ albumIds: [id] }) => {
if (id === "missing") throw new Error("Album no longer accessible");
return {
items: [{ id: `photo-${id}`, albums: [] }],
total: 1, nextPage: null, previousPage: null,
};
});
const result = await catalog.searchVisiblePhotos("editorial-1", { description: "hsv" });
expect(result.items.map(({ id }) => id)).toEqual(["photo-allowed"]);
});
test("does not call Immich when an editorial has no current album grants", async () => {
const { catalog, immich } = createCatalog({ grantedAlbumIds: [] });