mirror of
https://github.com/Radarr/Radarr.git
synced 2025-04-24 06:27:08 -04:00
Hide obsolete indexer flags from UI
This commit is contained in:
parent
e5963c9ee1
commit
28c566a071
1 changed files with 11 additions and 5 deletions
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using Radarr.Http;
|
||||
|
||||
|
@ -13,11 +14,16 @@ namespace Radarr.Api.V3.Indexers
|
|||
[HttpGet]
|
||||
public List<IndexerFlagResource> GetAll()
|
||||
{
|
||||
return Enum.GetValues(typeof(IndexerFlags)).Cast<IndexerFlags>().Select(f => new IndexerFlagResource
|
||||
{
|
||||
Id = (int)f,
|
||||
Name = f.ToString()
|
||||
}).ToList();
|
||||
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()
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue