Skip to content

High performance self-hosted photo and video management solution.

fix(web): incorrect shared album count (#677)

Alex9e4ed2214bcc
diff --git a/server/apps/immich/src/api-v1/album/album-repository.ts b/server/apps/immich/src/api-v1/album/album-repository.ts
index 5b8aaad0c1..e5c1c4bc7f 100644
--- a/server/apps/immich/src/api-v1/album/album-repository.ts
+++ b/server/apps/immich/src/api-v1/album/album-repository.ts
@@ -50,9 +50,14 @@ export class AlbumRepository implements IAlbumRepository {
where: { sharedUserId: userId },
});
- const sharingAlbums = ownedAlbums.map((album) => album.sharedUsers?.length || 0).reduce((a, b) => a + b, 0);
+ let sharedAlbumCount = 0;
+ ownedAlbums.map((album) => {
+ if (album.sharedUsers?.length) {
+ sharedAlbumCount += 1;
+ }
+ });
- return new AlbumCountResponseDto(ownedAlbums.length, sharedAlbums, sharingAlbums);
+ return new AlbumCountResponseDto(ownedAlbums.length, sharedAlbums, sharedAlbumCount);
}
async create(ownerId: string, createAlbumDto: CreateAlbumDto): Promise<AlbumEntity> {