Hide obsolete indexer flags from UI

pull/8710/head
Bogdan 1 year ago
parent e5963c9ee1
commit 28c566a071

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using Radarr.Http; using Radarr.Http;
@ -13,7 +14,12 @@ namespace Radarr.Api.V3.Indexers
[HttpGet] [HttpGet]
public List<IndexerFlagResource> GetAll() 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, Id = (int)f,
Name = f.ToString() Name = f.ToString()

Loading…
Cancel
Save