Skip to content

High performance self-hosted photo and video management solution.

fix(web): show one face for the same person in the detail panel (#4822)

martine1e45f3f32a6
diff --git a/server/src/domain/asset/response-dto/asset-response.dto.ts b/server/src/domain/asset/response-dto/asset-response.dto.ts
index 0f5e013202..bacd4bfe68 100644
--- a/server/src/domain/asset/response-dto/asset-response.dto.ts
+++ b/server/src/domain/asset/response-dto/asset-response.dto.ts
@@ -98,7 +98,14 @@ export function mapAsset(entity: AssetEntity, options: AssetMapOptions = {}): As
tags: entity.tags?.map(mapTag),
people: entity.faces
?.map(mapFace)
- .filter((person): person is PersonResponseDto => person !== null && !person.isHidden),
+ .filter((person): person is PersonResponseDto => person !== null && !person.isHidden)
+ .reduce((people, person) => {
+ const existingPerson = people.find((p) => p.id === person.id);
+ if (!existingPerson) {
+ people.push(person);
+ }
+ return people;
+ }, [] as PersonResponseDto[]),
checksum: entity.checksum.toString('base64'),
stackParentId: entity.stackParentId,
stack: withStack ? entity.stack?.map((a) => mapAsset(a, { stripMetadata })) ?? undefined : undefined,