High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
feat(web): search album description in add-to-album modal (#30462)
Gueye Papa Djadjida7d8c2e1291
diff --git a/web/src/lib/components/asset-viewer/AlbumListItem.svelte b/web/src/lib/components/asset-viewer/AlbumListItem.svelteindex af40deb27a..3d4be59a2c 100644--- a/web/src/lib/components/asset-viewer/AlbumListItem.svelte+++ b/web/src/lib/components/asset-viewer/AlbumListItem.svelte@@ -40,6 +40,9 @@const albumNameArray: string[] = $derived.by(() => {let { albumName } = album;let findIndex = normalizeSearchString(albumName).indexOf(normalizeSearchString(searchQuery));+ if (findIndex === -1) {+ return [albumName, '', ''];+ }let findLength = searchQuery.length;return [albumName.slice(0, findIndex),diff --git a/web/src/lib/components/shared-components/album-selection/album-selection-utils.spec.ts b/web/src/lib/components/shared-components/album-selection/album-selection-utils.spec.tsindex 669ce22f85..c7c3413b84 100644--- a/web/src/lib/components/shared-components/album-selection/album-selection-utils.spec.ts+++ b/web/src/lib/components/shared-components/album-selection/album-selection-utils.spec.ts@@ -108,6 +108,19 @@ describe('Album Modal', () => {]);});+ it('search matches on description as well as name', () => {+ const converter = new AlbumModalRowConverter(AlbumSortBy.MostRecentPhoto, SortOrder.Desc);+ const holidayAlbum = albumFactory.build({ albumName: 'Vacances 2019', description: 'Crete' });+ const constructionAlbum = albumFactory.build({ albumName: 'Construction' });+ const modalRows = converter.toModalRows('Crete', [], [holidayAlbum, constructionAlbum], -1, []);++ expect(modalRows).toStrictEqual([+ createNewAlbumRow(false),+ createSectionRow('ALBUMS'),+ createAlbumRow(holidayAlbum, false),+ ]);+ });+it('selection can select new album row', () => {const converter = new AlbumModalRowConverter(AlbumSortBy.MostRecentPhoto, SortOrder.Desc);const holidayAlbum = albumFactory.build({ albumName: 'Holidays' });diff --git a/web/src/lib/components/shared-components/album-selection/album-selection-utils.ts b/web/src/lib/components/shared-components/album-selection/album-selection-utils.tsindex ad96b27c06..5d4e46a063 100644--- a/web/src/lib/components/shared-components/album-selection/album-selection-utils.ts+++ b/web/src/lib/components/shared-components/album-selection/album-selection-utils.ts@@ -46,10 +46,14 @@ export class AlbumModalRowConverter {const recentAlbumsToShow = search.length === 0 ? recentAlbums : [];const rows: AlbumModalRow[] = [{ type: AlbumModalRowType.NEW_ALBUM, selected: selectedRowIndex === 0 }];+ const normalizedSearch = normalizeSearchString(search);const filteredAlbums = sortAlbums(search.length > 0 && albums.length > 0? albums.filter((album) => {- return normalizeSearchString(album.albumName).includes(normalizeSearchString(search));+ return (+ normalizeSearchString(album.albumName).includes(normalizedSearch) ||+ normalizeSearchString(album.description).includes(normalizedSearch)+ );}): albums,{ sortBy: this.sortBy, orderBy: this.orderBy },