From 7cd29c48bb64967c9b10ac35c9d20265f92385e0 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sat, 28 Nov 2020 16:34:07 -0500 Subject: [PATCH] Fixed: Importlist sync setting and validator --- src/NzbDrone.Api/Config/NetImportConfigModule.cs | 8 ++++---- src/NzbDrone.Api/Config/NetImportConfigResource.cs | 10 +++++----- src/NzbDrone.Core/Jobs/TaskManager.cs | 2 +- ...ImportConfigModule.cs => ImportListConfigModule.cs} | 0 ...rtConfigResource.cs => ImportListConfigResource.cs} | 0 .../Validation/NetImportSyncIntervalValidator.cs | 9 ++------- 6 files changed, 12 insertions(+), 17 deletions(-) rename src/Radarr.Api.V3/Config/{NetImportConfigModule.cs => ImportListConfigModule.cs} (100%) rename src/Radarr.Api.V3/Config/{NetImportConfigResource.cs => ImportListConfigResource.cs} (100%) diff --git a/src/NzbDrone.Api/Config/NetImportConfigModule.cs b/src/NzbDrone.Api/Config/NetImportConfigModule.cs index 87787a6cb..4375b3a90 100644 --- a/src/NzbDrone.Api/Config/NetImportConfigModule.cs +++ b/src/NzbDrone.Api/Config/NetImportConfigModule.cs @@ -3,18 +3,18 @@ using Radarr.Http.Validation; namespace NzbDrone.Api.Config { - public class ImportListConfigModule : NzbDroneConfigModule + public class NetImportConfigModule : NzbDroneConfigModule { - public ImportListConfigModule(IConfigService configService) + public NetImportConfigModule(IConfigService configService) : base(configService) { SharedValidator.RuleFor(c => c.ImportListSyncInterval) .IsValidImportListSyncInterval(); } - protected override ImportListConfigResource ToResource(IConfigService model) + protected override NetImportConfigResource ToResource(IConfigService model) { - return ImportListConfigResourceMapper.ToResource(model); + return NetImportConfigResourceMapper.ToResource(model); } } } diff --git a/src/NzbDrone.Api/Config/NetImportConfigResource.cs b/src/NzbDrone.Api/Config/NetImportConfigResource.cs index 77443dcaa..f9d6c6cef 100644 --- a/src/NzbDrone.Api/Config/NetImportConfigResource.cs +++ b/src/NzbDrone.Api/Config/NetImportConfigResource.cs @@ -1,20 +1,20 @@ -using NzbDrone.Core.Configuration; +using NzbDrone.Core.Configuration; using Radarr.Http.REST; namespace NzbDrone.Api.Config { - public class ImportListConfigResource : RestResource + public class NetImportConfigResource : RestResource { public int ImportListSyncInterval { get; set; } public string ListSyncLevel { get; set; } public string ImportExclusions { get; set; } } - public static class ImportListConfigResourceMapper + public static class NetImportConfigResourceMapper { - public static ImportListConfigResource ToResource(IConfigService model) + public static NetImportConfigResource ToResource(IConfigService model) { - return new ImportListConfigResource + return new NetImportConfigResource { ImportListSyncInterval = model.ImportListSyncInterval, ListSyncLevel = model.ListSyncLevel, diff --git a/src/NzbDrone.Core/Jobs/TaskManager.cs b/src/NzbDrone.Core/Jobs/TaskManager.cs index 8354256c8..2e46480b7 100644 --- a/src/NzbDrone.Core/Jobs/TaskManager.cs +++ b/src/NzbDrone.Core/Jobs/TaskManager.cs @@ -170,7 +170,7 @@ namespace NzbDrone.Core.Jobs rss.Interval = _configService.RssSyncInterval; var importList = _scheduledTaskRepository.GetDefinition(typeof(ImportListSyncCommand)); - importList.Interval = _configService.ImportListSyncInterval; + importList.Interval = GetImportListSyncInterval(); var refreshMonitoredDownloads = _scheduledTaskRepository.GetDefinition(typeof(RefreshMonitoredDownloadsCommand)); refreshMonitoredDownloads.Interval = _configService.CheckForFinishedDownloadInterval; diff --git a/src/Radarr.Api.V3/Config/NetImportConfigModule.cs b/src/Radarr.Api.V3/Config/ImportListConfigModule.cs similarity index 100% rename from src/Radarr.Api.V3/Config/NetImportConfigModule.cs rename to src/Radarr.Api.V3/Config/ImportListConfigModule.cs diff --git a/src/Radarr.Api.V3/Config/NetImportConfigResource.cs b/src/Radarr.Api.V3/Config/ImportListConfigResource.cs similarity index 100% rename from src/Radarr.Api.V3/Config/NetImportConfigResource.cs rename to src/Radarr.Api.V3/Config/ImportListConfigResource.cs diff --git a/src/Radarr.Http/Validation/NetImportSyncIntervalValidator.cs b/src/Radarr.Http/Validation/NetImportSyncIntervalValidator.cs index 812a1275c..c2719787d 100644 --- a/src/Radarr.Http/Validation/NetImportSyncIntervalValidator.cs +++ b/src/Radarr.Http/Validation/NetImportSyncIntervalValidator.cs @@ -5,7 +5,7 @@ namespace Radarr.Http.Validation public class ImportListSyncIntervalValidator : PropertyValidator { public ImportListSyncIntervalValidator() - : base("Must be between 10 and 1440 or 0 to disable") + : base("Must be greater than 6 hours") { } @@ -18,12 +18,7 @@ namespace Radarr.Http.Validation var value = (int)context.PropertyValue; - if (value == 0) - { - return true; - } - - if (value >= 10 && value <= 1440) + if (value >= 6) { return true; }