mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
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.Indexers.Exceptions;
|
using NzbDrone.Core.Indexers.Exceptions;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.ThingiProvider;
|
using NzbDrone.Core.ThingiProvider;
|
||||||
|
using NzbDrone.Core.Validation;
|
||||||
|
|
||||||
namespace NzbDrone.Core.ImportLists
|
namespace NzbDrone.Core.ImportLists
|
||||||
{
|
{
|
||||||
@ -187,7 +188,9 @@ protected virtual ValidationFailure TestConnection()
|
|||||||
|
|
||||||
if (releases.Empty())
|
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)
|
catch (RequestLimitReachedException)
|
||||||
|
@ -8,6 +8,8 @@ public class TraktListSettingsValidator : TraktSettingsBaseValidator<TraktListSe
|
|||||||
public TraktListSettingsValidator()
|
public TraktListSettingsValidator()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
|
RuleFor(c => c.Username).NotEmpty();
|
||||||
|
RuleFor(c => c.Listname).NotEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,9 +14,20 @@ public class TraktSettingsBaseValidator<TSettings> : AbstractValidator<TSettings
|
|||||||
public TraktSettingsBaseValidator()
|
public TraktSettingsBaseValidator()
|
||||||
{
|
{
|
||||||
RuleFor(c => c.Link).ValidRootUrl();
|
RuleFor(c => c.Link).ValidRootUrl();
|
||||||
RuleFor(c => c.AccessToken).NotEmpty();
|
|
||||||
RuleFor(c => c.RefreshToken).NotEmpty();
|
RuleFor(c => c.AccessToken).NotEmpty()
|
||||||
RuleFor(c => c.Expires).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
|
// Loose validation @TODO
|
||||||
RuleFor(c => c.Rating)
|
RuleFor(c => c.Rating)
|
||||||
|
Loading…
Reference in New Issue
Block a user