Skip to content

Commit

Permalink
Revert "fix: order APIv3 Images DTO before sending"
Browse files Browse the repository at this point in the history
This reverts commit a2c0340.
  • Loading branch information
harshithmohan committed Sep 30, 2024
1 parent a2c0340 commit b7e6e7a
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions Shoko.Server/API/v3/Helpers/APIv3_Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,6 @@ public static Images ToDto(this IEnumerable<IImageMetadata> imageList, IReadOnly
if (includeThumbnails)
SetPreferredOrDefaultImage(images.Thumbnails!, randomizeImages);
}
else
{
images.Posters = OrderImages(images.Posters);
images.Backdrops = OrderImages(images.Backdrops);
images.Banners = OrderImages(images.Banners);
images.Logos = OrderImages(images.Logos);
if (includeThumbnails)
images.Thumbnails = OrderImages(images.Thumbnails!);
}

return images;
}
Expand All @@ -106,13 +97,6 @@ private static void SetPreferredOrDefaultImage(List<Image> images, bool randomiz
images.Add(poster);
}

private static List<Image> OrderImages(List<Image> images)
=> images
.OrderByDescending(image => image.Preferred)
.ThenBy(image => string.IsNullOrEmpty(image.LanguageCode))
.ThenBy(image => (image.LanguageCode, image.Source, image.ID))
.ToList();

public static IReadOnlyList<Title> ToDto(this IEnumerable<TMDB_Title> titles, string? mainTitle = null, TMDB_Title? preferredTitle = null, IReadOnlySet<TitleLanguage>? language = null)
{
if (language != null && language.Count > 0)
Expand Down

0 comments on commit b7e6e7a

Please sign in to comment.