High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix: include unamed people in otherPeople (#32237)
Jason Rasmussen9971dade1b2d
diff --git a/server/src/queries/person.repository.sql b/server/src/queries/person.repository.sqlindex 4fc551f37c..7eb7c3bd19 100644--- a/server/src/queries/person.repository.sql+++ b/server/src/queries/person.repository.sql@@ -184,10 +184,6 @@ selectand "person_user"."sharedWithId" = $2where"other"."personGroupId" = "person_group"."id"- and (- "other"."birthDate" is not null- or "other"."name" != $3- )) as agg) as "otherPeople",(@@ -209,7 +205,7 @@ selectand "user"."deletedAt" is nullwhere"person_user"."personGroupId" = "person_group"."id"- and "person_user"."sharedWithId" = $4+ and "person_user"."sharedWithId" = $3order by"user"."name") as agg@@ -233,7 +229,7 @@ selectand "user"."deletedAt" is nullwhere"person_user"."personGroupId" = "person_group"."id"- and "person_user"."sharedById" = $5+ and "person_user"."sharedById" = $4order by"user"."name") as agg@@ -242,7 +238,7 @@ from"similarity_threshold","person_group"inner join "person" as "owned" on "owned"."personGroupId" = "person_group"."id"- and "owned"."ownerId" = $6+ and "owned"."ownerId" = $5inner join "asset_face" on "asset_face"."personGroupId" = "person_group"."id"and "asset_face"."deletedAt" is nulland "asset_face"."isVisible" is true@@ -250,7 +246,7 @@ fromand "asset"."visibility" = 'timeline'and "asset"."deletedAt" is nulland (- "asset"."ownerId" = any ($7::uuid[])+ "asset"."ownerId" = any ($6::uuid[])or exists (select1 as "exists"@@ -259,13 +255,13 @@ frominner join "album" on "album"."id" = "album_asset"."albumId"and "album"."deletedAt" is nullinner join "album_user" on "album_user"."albumId" = "album"."id"- and "album_user"."userId" = $8::uuid+ and "album_user"."userId" = $7::uuidwhere"album_asset"."assetId" = "asset"."id"))where- "owned"."isHidden" = $9+ "owned"."isHidden" = $8and 1 = 1group by"person_group"."id",@@ -273,7 +269,7 @@ group by"owned"."personGroupId"having(- "owned"."name" != $10+ "owned"."name" != $9or count("asset"."id") >= COALESCE((SELECT@@ -281,7 +277,7 @@ havingFROMuser_metadataWHERE- "userId" = $11+ "userId" = $10AND key = 'preferences'),'3'@@ -295,9 +291,9 @@ order byNULLIF("owned"."name", '') asc nulls last,"owned"."createdAt"limit- $12+ $11offset- $13+ $12-- PersonRepository.getAllWithoutFacesselect@@ -344,10 +340,6 @@ selectand "person_user"."sharedWithId" = $1where"other"."personGroupId" = "person"."personGroupId"- and (- "other"."birthDate" is not null- or "other"."name" != $2- )) as agg) as "otherPeople",(@@ -369,7 +361,7 @@ selectand "user"."deletedAt" is nullwhere"person_user"."personGroupId" = "person"."personGroupId"- and "person_user"."sharedWithId" = $3+ and "person_user"."sharedWithId" = $2order by"user"."name") as agg@@ -393,7 +385,7 @@ selectand "user"."deletedAt" is nullwhere"person_user"."personGroupId" = "person"."personGroupId"- and "person_user"."sharedById" = $4+ and "person_user"."sharedById" = $3order by"user"."name") as agg@@ -402,15 +394,15 @@ select"person"where"person"."personGroupId" = "asset_face"."personGroupId"- and "person"."ownerId" = $5+ and "person"."ownerId" = $4) as obj) as "person"from"asset_face"where- "asset_face"."assetId" = $6+ "asset_face"."assetId" = $5and "asset_face"."deletedAt" is null- and "asset_face"."isVisible" = $7+ and "asset_face"."isVisible" = $6order by"asset_face"."boundingBoxX1" asc@@ -441,10 +433,6 @@ selectand "person_user"."sharedWithId" = $1where"other"."personGroupId" = "person"."personGroupId"- and (- "other"."birthDate" is not null- or "other"."name" != $2- )) as agg) as "otherPeople",(@@ -466,7 +454,7 @@ selectand "user"."deletedAt" is nullwhere"person_user"."personGroupId" = "person"."personGroupId"- and "person_user"."sharedWithId" = $3+ and "person_user"."sharedWithId" = $2order by"user"."name") as agg@@ -490,7 +478,7 @@ selectand "user"."deletedAt" is nullwhere"person_user"."personGroupId" = "person"."personGroupId"- and "person_user"."sharedById" = $4+ and "person_user"."sharedById" = $3order by"user"."name") as agg@@ -499,13 +487,13 @@ select"person"where"person"."personGroupId" = "asset_face"."personGroupId"- and "person"."ownerId" = $5+ and "person"."ownerId" = $4) as obj) as "person"from"asset_face"where- "asset_face"."id" = $6+ "asset_face"."id" = $5and "asset_face"."deletedAt" is null-- PersonRepository.getFaceForFacialRecognitionJob@@ -621,10 +609,6 @@ selectand "person_user"."sharedWithId" = $2where"other"."personGroupId" = "person_group"."id"- and (- "other"."birthDate" is not null- or "other"."name" != $3- )) as agg) as "otherPeople",(@@ -646,7 +630,7 @@ selectand "user"."deletedAt" is nullwhere"person_user"."personGroupId" = "person_group"."id"- and "person_user"."sharedWithId" = $4+ and "person_user"."sharedWithId" = $3order by"user"."name") as agg@@ -670,7 +654,7 @@ selectand "user"."deletedAt" is nullwhere"person_user"."personGroupId" = "person_group"."id"- and "person_user"."sharedById" = $5+ and "person_user"."sharedById" = $4order by"user"."name") as agg@@ -678,7 +662,7 @@ selectfrom"person_group"where- "person_group"."id" = $6+ "person_group"."id" = $5and exists (select"person"."ownerId"@@ -686,7 +670,7 @@ where"person"where"person"."personGroupId" = "person_group"."id"- and "person"."ownerId" = $7+ and "person"."ownerId" = $6)-- PersonRepository.getByGroupId@@ -709,10 +693,6 @@ selectand "person_user"."sharedWithId" = $1where"other"."personGroupId" = "person"."personGroupId"- and (- "other"."birthDate" is not null- or "other"."name" != $2- )) as agg) as "otherPeople",(@@ -734,7 +714,7 @@ selectand "user"."deletedAt" is nullwhere"person_user"."personGroupId" = "person"."personGroupId"- and "person_user"."sharedWithId" = $3+ and "person_user"."sharedWithId" = $2order by"user"."name") as agg@@ -758,7 +738,7 @@ selectand "user"."deletedAt" is nullwhere"person_user"."personGroupId" = "person"."personGroupId"- and "person_user"."sharedById" = $4+ and "person_user"."sharedById" = $3order by"user"."name") as agg@@ -766,8 +746,8 @@ selectfrom"person"where- "person"."personGroupId" = $5- and "person"."ownerId" = $6+ "person"."personGroupId" = $4+ and "person"."ownerId" = $5-- PersonRepository.getForThumbnailselect@@ -824,10 +804,6 @@ selectand "person_user"."sharedWithId" = $1where"other"."personGroupId" = "person"."personGroupId"- and (- "other"."birthDate" is not null- or "other"."name" != $2- )) as agg) as "otherPeople",(@@ -849,7 +825,7 @@ selectand "user"."deletedAt" is nullwhere"person_user"."personGroupId" = "person"."personGroupId"- and "person_user"."sharedWithId" = $3+ and "person_user"."sharedWithId" = $2order by"user"."name") as agg@@ -873,7 +849,7 @@ selectand "user"."deletedAt" is nullwhere"person_user"."personGroupId" = "person"."personGroupId"- and "person_user"."sharedById" = $4+ and "person_user"."sharedById" = $3order by"user"."name") as agg@@ -882,12 +858,12 @@ from"similarity_threshold","person"where- "person"."ownerId" = $5- and f_unaccent ("person"."name") %> f_unaccent ($6)+ "person"."ownerId" = $4+ and f_unaccent ("person"."name") %> f_unaccent ($5)order by- f_unaccent ("person"."name") <->>> f_unaccent ($7)+ f_unaccent ("person"."name") <->>> f_unaccent ($6)limit- $8+ $7-- PersonRepository.getDistinctNamesselect distinct@@ -1187,10 +1163,6 @@ selectand "person_user"."sharedWithId" = $1where"other"."personGroupId" = "person"."personGroupId"- and (- "other"."birthDate" is not null- or "other"."name" != $2- )) as agg) as "otherPeople",(@@ -1212,7 +1184,7 @@ selectand "user"."deletedAt" is nullwhere"person_user"."personGroupId" = "person"."personGroupId"- and "person_user"."sharedWithId" = $3+ and "person_user"."sharedWithId" = $2order by"user"."name") as agg@@ -1236,7 +1208,7 @@ selectand "user"."deletedAt" is nullwhere"person_user"."personGroupId" = "person"."personGroupId"- and "person_user"."sharedById" = $4+ and "person_user"."sharedById" = $3order by"user"."name") as agg@@ -1245,14 +1217,14 @@ select"person"where"person"."personGroupId" = "asset_face"."personGroupId"- and "person"."ownerId" = $5+ and "person"."ownerId" = $4) as obj) as "person"from"asset_face"where- "asset_face"."assetId" in ($6)- and "asset_face"."personGroupId" in ($7)+ "asset_face"."assetId" in ($5)+ and "asset_face"."personGroupId" in ($6)and "asset_face"."deletedAt" is null-- PersonRepository.getRandomFacediff --git a/server/src/repositories/person.repository.ts b/server/src/repositories/person.repository.tsindex ba8844a8b1..9b9235b8b9 100644--- a/server/src/repositories/person.repository.ts+++ b/server/src/repositories/person.repository.ts@@ -138,8 +138,7 @@ const withOtherPeopleFor = (userId: string, personGroupId: Expression<string>) =.on('person_user.sharedWithId', '=', userId),).select(['person_user.sharedById', 'person_user.role', 'other.name', 'other.birthDate'])- .where('other.personGroupId', '=', personGroupId)- .where((eb) => eb.or([eb('other.birthDate', 'is not', null), eb('other.name', '!=', '')])),+ .where('other.personGroupId', '=', personGroupId),).as('otherPeople');const withPersonUsersFor = (userId: string, personGroupId: Expression<string>, direction: SharingDirection) => {