mirror of https://github.com/Radarr/Radarr
Improved Trakt list validation
Fixes #5262 Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
parent
a03d136aa4
commit
45011198e2
|
@ -13,6 +13,7 @@ using NzbDrone.Core.ImportLists.ImportListMovies;
|
|||
using NzbDrone.Core.Indexers.Exceptions;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.ImportLists
|
||||
{
|
||||
|
@ -187,7 +188,9 @@ namespace NzbDrone.Core.ImportLists
|
|||
|
||||
if (releases.Empty())
|
||||
{
|
||||
return new ValidationFailure(string.Empty, "No results were returned from your list, please check your settings.");
|
||||
return new NzbDroneValidationFailure(string.Empty,
|
||||
"No results were returned from your import list, please check your settings.")
|
||||
{ IsWarning = true };
|
||||
}
|
||||
}
|
||||
catch (RequestLimitReachedException)
|
||||
|
|
|
@ -8,6 +8,8 @@ namespace NzbDrone.Core.ImportLists.Trakt.List
|
|||
public TraktListSettingsValidator()
|
||||
: base()
|
||||
{
|
||||
RuleFor(c => c.Username).NotEmpty();
|
||||
RuleFor(c => c.Listname).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,9 +14,20 @@ namespace NzbDrone.Core.ImportLists.Trakt
|
|||
public TraktSettingsBaseValidator()
|
||||
{
|
||||
RuleFor(c => c.Link).ValidRootUrl();
|
||||
RuleFor(c => c.AccessToken).NotEmpty();
|
||||
RuleFor(c => c.RefreshToken).NotEmpty();
|
||||
RuleFor(c => c.Expires).NotEmpty();
|
||||
|
||||
RuleFor(c => c.AccessToken).NotEmpty()
|
||||
.OverridePropertyName("SignIn")
|
||||
.WithMessage("Must authenticate with Trakt");
|
||||
|
||||
RuleFor(c => c.RefreshToken).NotEmpty()
|
||||
.OverridePropertyName("SignIn")
|
||||
.WithMessage("Must authenticate with Trakt")
|
||||
.When(c => c.AccessToken.IsNotNullOrWhiteSpace());
|
||||
|
||||
RuleFor(c => c.Expires).NotEmpty()
|
||||
.OverridePropertyName("SignIn")
|
||||
.WithMessage("Must authenticate with Trakt")
|
||||
.When(c => c.AccessToken.IsNotNullOrWhiteSpace() && c.RefreshToken.IsNotNullOrWhiteSpace());
|
||||
|
||||
// Loose validation @TODO
|
||||
RuleFor(c => c.Rating)
|
||||
|
|
Loading…
Reference in New Issue