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 c3a7491cfb..666168a195 100644 --- a/server/src/domain/asset/response-dto/asset-response.dto.ts +++ b/server/src/domain/asset/response-dto/asset-response.dto.ts @@ -1,6 +1,6 @@ import { AssetEntity, AssetFaceEntity, AssetType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; -import { PersonWithFacesResponseDto } from '../../person/person.dto'; +import { PersonWithFacesResponseDto, mapFacesWithoutPerson, mapPerson } from '../../person/person.dto'; import { TagResponseDto, mapTag } from '../../tag'; import { UserResponseDto, mapUser } from '../../user/response-dto/user-response.dto'; import { ExifResponseDto, mapExif } from './exif-response.dto'; @@ -62,7 +62,7 @@ const peopleWithFaces = (faces: AssetFaceEntity[]): PersonWithFacesResponseDto[] if (existingPersonEntry) { existingPersonEntry.faces.push(face); } else { - result.push({ ...face.person!, faces: [face] }); + result.push({ ...mapPerson(face.person!), faces: [mapFacesWithoutPerson(face)] }); } } }); diff --git a/server/src/domain/person/person.dto.ts b/server/src/domain/person/person.dto.ts index ed46933939..c4a5bb68ea 100644 --- a/server/src/domain/person/person.dto.ts +++ b/server/src/domain/person/person.dto.ts @@ -144,7 +144,7 @@ export function mapPerson(person: PersonEntity): PersonResponseDto { }; } -export function mapFaces(face: AssetFaceEntity, authUser: AuthUserDto): AssetFaceResponseDto { +export function mapFacesWithoutPerson(face: AssetFaceEntity): AssetFaceWithoutPersonResponseDto { return { id: face.id, imageHeight: face.imageHeight, @@ -153,6 +153,12 @@ export function mapFaces(face: AssetFaceEntity, authUser: AuthUserDto): AssetFac boundingBoxX2: face.boundingBoxX2, boundingBoxY1: face.boundingBoxY1, boundingBoxY2: face.boundingBoxY2, + }; +} + +export function mapFaces(face: AssetFaceEntity, authUser: AuthUserDto): AssetFaceResponseDto { + return { + ...mapFacesWithoutPerson(face), person: face.person?.ownerId === authUser.id ? mapPerson(face.person) : null, }; } diff --git a/web/src/lib/components/asset-viewer/detail-panel.svelte b/web/src/lib/components/asset-viewer/detail-panel.svelte index 7f73fb2ed5..3dc802ac46 100644 --- a/web/src/lib/components/asset-viewer/detail-panel.svelte +++ b/web/src/lib/components/asset-viewer/detail-panel.svelte @@ -228,51 +228,52 @@
{#each people as person, index (person.id)} -
($boundingBoxesArray = people[index].faces)} - on:mouseover={() => ($boundingBoxesArray = people[index].faces)} - on:mouseleave={() => ($boundingBoxesArray = [])} - > - dispatch('close-viewer')} + {#if showingHiddenPeople || !person.isHidden} + + dispatch('close-viewer')} + > +
+
+

{person.name}

+ {#if person.birthDate} + {@const personBirthDate = DateTime.fromISO(person.birthDate)} +

+ Age {Math.floor(DateTime.fromISO(asset.fileCreatedAt).diff(personBirthDate, 'years').years)} +

+ {/if} +
+
+ {/if} {/each}
diff --git a/web/src/lib/components/faces-page/people-list.svelte b/web/src/lib/components/faces-page/people-list.svelte index adf59c40c1..89082911ac 100644 --- a/web/src/lib/components/faces-page/people-list.svelte +++ b/web/src/lib/components/faces-page/people-list.svelte @@ -30,7 +30,9 @@ people = peopleCopy.filter( (person) => !unselectedPeople.some((unselectedPerson) => unselectedPerson.id === person.id), ); - people = searchNameLocal(name, people, 10); + if (name) { + people = searchNameLocal(name, people, 10); + } } const searchPeople = async (force: boolean) => {