fix: prioritize authorized search album

This commit is contained in:
Leon Tonhäuser committed 2026-08-12 17:58:27 +02:00
1 parent 9aa79cbce9
commit a3dc56778d
2 files changed
+35 -3

No files matched your search

+28
View File
@@ -84,6 +84,34 @@ test("restores the queried granted album when Immich omits an asset album associ
expect(result.items[0]?.albums).toEqual([{ id: "allowed" }]);
});
test("moves the queried granted album to the active gallery context without losing metadata", async () => {
const { catalog, immich } = createCatalog({ grantedAlbumIds: ["allowed"] });
immich.searchPhotos.mockResolvedValue({
items: [{
id: "asset-1",
type: "IMAGE",
originalFileName: "tor.jpg",
originalMimeType: "image/jpeg",
localDateTime: null,
fileCreatedAt: null,
albums: [
{ id: "other", albumName: "Anderes Album" },
{ id: "allowed", albumName: "Erlaubtes Album" },
],
}],
total: 1,
nextPage: null,
previousPage: null,
});
const result = await catalog.searchVisiblePhotos("editorial-1", { page: 1 });
expect(result.items[0]?.albums).toEqual([
{ id: "allowed", albumName: "Erlaubtes Album" },
{ id: "other", albumName: "Anderes Album" },
]);
});
test("does not call Immich when an editorial has no current album grants", async () => {
const { catalog, immich } = createCatalog({ grantedAlbumIds: [] });