Use first sorted by path image as cover by default (#2407)

This commit is contained in:
WithoutPants 2022-03-23 08:12:02 +11:00 committed by GitHub
parent 228e8c9bfd
commit b4ecb63e1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -40,7 +40,8 @@ func (r *galleryResolver) Images(ctx context.Context, obj *models.Gallery) (ret
func (r *galleryResolver) Cover(ctx context.Context, obj *models.Gallery) (ret *models.Image, err error) {
if err := r.withReadTxn(ctx, func(repo models.ReaderRepository) error {
imgs, err := image.FindByGalleryID(repo.Image(), obj.ID, "", "")
// #2376 - use first image (sorted by path) if no cover is present
imgs, err := image.FindByGalleryID(repo.Image(), obj.ID, "path", models.SortDirectionEnumAsc)
if err != nil {
return err
}