mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
Use first sorted by path image as cover by default (#2407)
This commit is contained in:
@@ -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) {
|
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 {
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user