1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 18:02:44 +01:00

Hide obsolete indexer flags from UI

This commit is contained in:
Bogdan 2023-09-09 15:36:57 +03:00
parent e5963c9ee1
commit 28c566a071

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Parser.Model;
using Radarr.Http;
@ -13,7 +14,12 @@ public class IndexerFlagController : Controller
[HttpGet]
public List<IndexerFlagResource> GetAll()
{
return Enum.GetValues(typeof(IndexerFlags)).Cast<IndexerFlags>().Select(f => new IndexerFlagResource
var type = typeof(IndexerFlags);
return Enum.GetValues(type)
.Cast<IndexerFlags>()
.Where(f => type.GetField(f.ToString())?.GetCustomAttributes(false).OfType<ObsoleteAttribute>().Empty() ?? true)
.Select(f => new IndexerFlagResource
{
Id = (int)f,
Name = f.ToString()