You've already forked pigallery2
mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-12-01 22:52:06 +02:00
Fixing projected Persons UI bugs #1015
This commit is contained in:
@@ -75,6 +75,9 @@ export class PersonManager implements IObjectManager {
|
||||
|
||||
// Apply projection query if it exists
|
||||
if (session.projectionQuery) {
|
||||
if (session.hasDirectoryProjection) {
|
||||
baseQb.leftJoin('media.directory', 'directory');
|
||||
}
|
||||
baseQb.andWhere(session.projectionQuery);
|
||||
}
|
||||
|
||||
@@ -96,6 +99,9 @@ export class PersonManager implements IObjectManager {
|
||||
|
||||
// Apply projection query if it exists
|
||||
if (session.projectionQuery) {
|
||||
if (session.hasDirectoryProjection) {
|
||||
sampleQb.leftJoin('media.directory', 'directory');
|
||||
}
|
||||
sampleQb.andWhere(session.projectionQuery);
|
||||
}
|
||||
|
||||
@@ -309,7 +315,7 @@ export class PersonManager implements IObjectManager {
|
||||
this.personsCache = this.personsCache || {};
|
||||
const persons = await personRepository
|
||||
.createQueryBuilder('person')
|
||||
.leftJoin('person.cache', 'cache', 'cache.projectionKey = :pk AND cache.valid = 1', {pk: session.user.projectionKey})
|
||||
.leftJoin('person.cache', 'cache', 'cache.projectionKey = :pk', {pk: session.user.projectionKey})
|
||||
.leftJoin('cache.sampleRegion', 'sampleRegion')
|
||||
.leftJoin('sampleRegion.media', 'media')
|
||||
.leftJoin('media.directory', 'directory')
|
||||
@@ -319,10 +325,11 @@ export class PersonManager implements IObjectManager {
|
||||
'person.isFavourite',
|
||||
'cache.count',
|
||||
'sampleRegion',
|
||||
'media.name',
|
||||
'media',
|
||||
'directory.path',
|
||||
'directory.name'
|
||||
])
|
||||
.where('cache.valid = 1 AND cache.count > 0')
|
||||
.getMany();
|
||||
|
||||
// Fix cache property: convert from array to single object
|
||||
|
||||
@@ -128,10 +128,11 @@ export class SearchManager {
|
||||
await personRepository
|
||||
.createQueryBuilder('person')
|
||||
.select('DISTINCT(person.name), cache.count')
|
||||
.leftJoin('person.cache', 'cache', 'cache.projectionKey = :pk AND cache.valid = 1', {pk: session.user.projectionKey})
|
||||
.leftJoin('person.cache', 'cache', 'cache.projectionKey = :pk', {pk: session.user.projectionKey})
|
||||
.where('person.name LIKE :text COLLATE ' + SQL_COLLATE, {
|
||||
text: '%' + text + '%',
|
||||
})
|
||||
.andWhere('cache.count > 0 AND cache.valid = 1')
|
||||
.limit(
|
||||
Config.Search.AutoComplete.ItemsPerCategory.person
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export interface PersonDTO {
|
||||
cache: PersonCacheDTO;
|
||||
id: number;
|
||||
name: string;
|
||||
missingThumbnail?: boolean;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {PersonDTO} from '../../../../common/entities/PersonDTO';
|
||||
import {PersonCacheDTO, PersonDTO} from '../../../../common/entities/PersonDTO';
|
||||
import {Config} from '../../../../common/config/public/Config';
|
||||
import {Utils} from '../../../../common/Utils';
|
||||
|
||||
@@ -7,6 +7,7 @@ export class Person implements PersonDTO {
|
||||
count: number;
|
||||
id: number;
|
||||
name: string;
|
||||
cache:PersonCacheDTO;
|
||||
|
||||
|
||||
public static getThumbnailUrl(that: PersonDTO): string {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
[class.clickable]="CanUpdate"
|
||||
(click)="CanUpdate && toggleFavourite($event)"
|
||||
></ng-icon>
|
||||
{{person.name}} ({{person.count}})
|
||||
{{person.name}} ({{person.cache.count}})
|
||||
|
||||
</div>
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user