mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-03 19:29:32 -05:00 
			
		
		
		
	fix(web): don't limit merge face selector to 10 people (#5551)
* fix: don't limit merge face selector to 10 people * fix: don't use class to hide people in detail-panel * fix: map faces and person in asset response
This commit is contained in:
		
							parent
							
								
									d2fbbe790b
								
							
						
					
					
						commit
						7b3465621f
					
				@ -1,6 +1,6 @@
 | 
				
			|||||||
import { AssetEntity, AssetFaceEntity, AssetType } from '@app/infra/entities';
 | 
					import { AssetEntity, AssetFaceEntity, AssetType } from '@app/infra/entities';
 | 
				
			||||||
import { ApiProperty } from '@nestjs/swagger';
 | 
					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 { TagResponseDto, mapTag } from '../../tag';
 | 
				
			||||||
import { UserResponseDto, mapUser } from '../../user/response-dto/user-response.dto';
 | 
					import { UserResponseDto, mapUser } from '../../user/response-dto/user-response.dto';
 | 
				
			||||||
import { ExifResponseDto, mapExif } from './exif-response.dto';
 | 
					import { ExifResponseDto, mapExif } from './exif-response.dto';
 | 
				
			||||||
@ -62,7 +62,7 @@ const peopleWithFaces = (faces: AssetFaceEntity[]): PersonWithFacesResponseDto[]
 | 
				
			|||||||
        if (existingPersonEntry) {
 | 
					        if (existingPersonEntry) {
 | 
				
			||||||
          existingPersonEntry.faces.push(face);
 | 
					          existingPersonEntry.faces.push(face);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          result.push({ ...face.person!, faces: [face] });
 | 
					          result.push({ ...mapPerson(face.person!), faces: [mapFacesWithoutPerson(face)] });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
				
			|||||||
@ -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 {
 | 
					  return {
 | 
				
			||||||
    id: face.id,
 | 
					    id: face.id,
 | 
				
			||||||
    imageHeight: face.imageHeight,
 | 
					    imageHeight: face.imageHeight,
 | 
				
			||||||
@ -153,6 +153,12 @@ export function mapFaces(face: AssetFaceEntity, authUser: AuthUserDto): AssetFac
 | 
				
			|||||||
    boundingBoxX2: face.boundingBoxX2,
 | 
					    boundingBoxX2: face.boundingBoxX2,
 | 
				
			||||||
    boundingBoxY1: face.boundingBoxY1,
 | 
					    boundingBoxY1: face.boundingBoxY1,
 | 
				
			||||||
    boundingBoxY2: face.boundingBoxY2,
 | 
					    boundingBoxY2: face.boundingBoxY2,
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function mapFaces(face: AssetFaceEntity, authUser: AuthUserDto): AssetFaceResponseDto {
 | 
				
			||||||
 | 
					  return {
 | 
				
			||||||
 | 
					    ...mapFacesWithoutPerson(face),
 | 
				
			||||||
    person: face.person?.ownerId === authUser.id ? mapPerson(face.person) : null,
 | 
					    person: face.person?.ownerId === authUser.id ? mapPerson(face.person) : null,
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -228,6 +228,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      <div class="mt-2 flex flex-wrap gap-2">
 | 
					      <div class="mt-2 flex flex-wrap gap-2">
 | 
				
			||||||
        {#each people as person, index (person.id)}
 | 
					        {#each people as person, index (person.id)}
 | 
				
			||||||
 | 
					          {#if showingHiddenPeople || !person.isHidden}
 | 
				
			||||||
            <div
 | 
					            <div
 | 
				
			||||||
              class="w-[90px]"
 | 
					              class="w-[90px]"
 | 
				
			||||||
              role="button"
 | 
					              role="button"
 | 
				
			||||||
@ -238,7 +239,6 @@
 | 
				
			|||||||
            >
 | 
					            >
 | 
				
			||||||
              <a
 | 
					              <a
 | 
				
			||||||
                href="/people/{person.id}?previousRoute={albumId ? `${AppRoute.ALBUMS}/${albumId}` : AppRoute.PHOTOS}"
 | 
					                href="/people/{person.id}?previousRoute={albumId ? `${AppRoute.ALBUMS}/${albumId}` : AppRoute.PHOTOS}"
 | 
				
			||||||
              class=" {!showingHiddenPeople && person.isHidden ? 'hidden' : ''}"
 | 
					 | 
				
			||||||
                on:click={() => dispatch('close-viewer')}
 | 
					                on:click={() => dispatch('close-viewer')}
 | 
				
			||||||
              >
 | 
					              >
 | 
				
			||||||
                <div class="relative">
 | 
					                <div class="relative">
 | 
				
			||||||
@ -273,6 +273,7 @@
 | 
				
			|||||||
                {/if}
 | 
					                {/if}
 | 
				
			||||||
              </a>
 | 
					              </a>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
 | 
					          {/if}
 | 
				
			||||||
        {/each}
 | 
					        {/each}
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </section>
 | 
					    </section>
 | 
				
			||||||
 | 
				
			|||||||
@ -30,8 +30,10 @@
 | 
				
			|||||||
    people = peopleCopy.filter(
 | 
					    people = peopleCopy.filter(
 | 
				
			||||||
      (person) => !unselectedPeople.some((unselectedPerson) => unselectedPerson.id === person.id),
 | 
					      (person) => !unselectedPeople.some((unselectedPerson) => unselectedPerson.id === person.id),
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					    if (name) {
 | 
				
			||||||
      people = searchNameLocal(name, people, 10);
 | 
					      people = searchNameLocal(name, people, 10);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const searchPeople = async (force: boolean) => {
 | 
					  const searchPeople = async (force: boolean) => {
 | 
				
			||||||
    if (name === '') {
 | 
					    if (name === '') {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user