Hide faces from frontend if disabled

This commit is contained in:
viktorstrate
2021-08-31 12:05:46 +02:00
parent 9bcfdbb2cd
commit 521b121613
9 changed files with 49 additions and 41 deletions

View File

@@ -8,6 +8,7 @@ import (
api "github.com/photoview/photoview/api/graphql"
"github.com/photoview/photoview/api/graphql/auth"
"github.com/photoview/photoview/api/graphql/models"
"github.com/photoview/photoview/api/scanner/face_detection"
"github.com/pkg/errors"
"gorm.io/gorm/clause"
)
@@ -228,6 +229,10 @@ func (r *mutationResolver) FavoriteMedia(ctx context.Context, mediaID int, favor
}
func (r *mediaResolver) Faces(ctx context.Context, media *models.Media) ([]*models.ImageFace, error) {
if face_detection.GlobalFaceDetector == nil {
return []*models.ImageFace{}, nil
}
if media.Faces != nil {
return media.Faces, nil
}