Skip to content

Commit

Permalink
Fix Custom Directory Filters in V2
Browse files Browse the repository at this point in the history
  • Loading branch information
da3dsoul committed Jul 7, 2024
1 parent 3d56bf2 commit 57fdbfb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Shoko.Server/API/v2/Modules/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2738,7 +2738,7 @@ internal object GetAllFilters(int uid, bool nocast, bool notag, int level, bool
var evaluator = HttpContext.RequestServices.GetRequiredService<FilterEvaluator>();
var user = HttpContext.GetUser();
var hideCategories = user.GetHideCategories();
var allFPs = level > 1
var allFPs = level > 0
? RepoFactory.FilterPreset.GetAllFiltersForLegacy().Where(a => !a.Hidden && ((a.FilterType & GroupFilterType.Tag) == 0 || !hideCategories.Contains(a.Name))).ToList()
: RepoFactory.FilterPreset.GetAllFiltersForLegacy(true).Where(a => !a.Hidden).ToList();
var result = evaluator.BatchEvaluateFilters(allFPs, user.JMMUserID, true);
Expand Down
1 change: 1 addition & 0 deletions Shoko.Server/Repositories/Cached/AnimeSeriesRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ public List<SVR_AnimeSeries> GetWithMultipleReleases(bool ignoreVariations)
public IEnumerable<int> GetAllYears()
{
var anime = RepoFactory.AnimeSeries.GetAll().Select(a => RepoFactory.AniDB_Anime.GetByAnimeID(a.AniDB_ID)).Where(a => a?.AirDate != null).ToList();
if (anime.Count == 0) yield break;
var minDate = anime.Min(a => a.AirDate!.Value);
var maxDate = anime.Max(o => o.EndDate ?? DateTime.Today);

Expand Down
2 changes: 1 addition & 1 deletion Shoko.Server/Repositories/Cached/FilterPresetRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public static IReadOnlyList<FilterPreset> GetAllTagFilters(int offset = 0)
public IReadOnlyList<FilterPreset> GetAllFiltersForLegacy(bool topLevel = false)
{
if (topLevel)
return GetTopLevel().Where(a => !a.IsDirectory()).Concat(DirectoryFilters).ToList();
return GetTopLevel().Concat(DirectoryFilters).ToList();

var filters = GetAll().ToList();
filters.AddRange(DirectoryFilters);
Expand Down

0 comments on commit 57fdbfb

Please sign in to comment.