From b4ecb63e1c6c36adde07af2b5fa0aee3c4adc873 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Wed, 23 Mar 2022 08:12:02 +1100 Subject: [PATCH] Use first sorted by path image as cover by default (#2407) --- internal/api/resolver_model_gallery.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/api/resolver_model_gallery.go b/internal/api/resolver_model_gallery.go index 9d6db3011..9e5306cbd 100644 --- a/internal/api/resolver_model_gallery.go +++ b/internal/api/resolver_model_gallery.go @@ -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 }