1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-18 21:35:51 -04:00

Fixed: Enforce validation warnings

(cherry picked from commit 48ee1158ad4213fd0690842e2672f52d08f7ad26)

Closes #8628
This commit is contained in:
Bogdan
2023-05-26 18:35:31 +03:00
parent 713f984b26
commit 9df06b80bf
3 changed files with 6 additions and 8 deletions
@@ -32,9 +32,9 @@ function createSaveProviderHandler(section, url, options = {}) {
const params = { ...queryParams }; const params = { ...queryParams };
// If the user is re-saving the same provider without changes // If the user is re-saving the same provider without changes
// force it to be saved. Only applies to editing existing providers. // force it to be saved.
if (id && _.isEqual(saveData, lastSaveData)) { if (_.isEqual(saveData, lastSaveData)) {
params.forceSave = true; params.forceSave = true;
} }
@@ -36,8 +36,6 @@ namespace NzbDrone.Core.Indexers
public class SeedCriteriaSettings public class SeedCriteriaSettings
{ {
private static readonly SeedCriteriaSettingsValidator Validator = new SeedCriteriaSettingsValidator();
[FieldDefinition(0, Type = FieldType.Textbox, Label = "Seed Ratio", HelpText = "The ratio a torrent should reach before stopping, empty is download client's default. Ratio should be at least 1.0 and follow the indexers rules")] [FieldDefinition(0, Type = FieldType.Textbox, Label = "Seed Ratio", HelpText = "The ratio a torrent should reach before stopping, empty is download client's default. Ratio should be at least 1.0 and follow the indexers rules")]
public double? SeedRatio { get; set; } public double? SeedRatio { get; set; }
+4 -4
View File
@@ -66,9 +66,9 @@ namespace Radarr.Api.V3
} }
[RestPostById] [RestPostById]
public ActionResult<TProviderResource> CreateProvider(TProviderResource providerResource) public ActionResult<TProviderResource> CreateProvider([FromBody] TProviderResource providerResource, [FromQuery] bool forceSave = false)
{ {
var providerDefinition = GetDefinition(providerResource, true, false, false); var providerDefinition = GetDefinition(providerResource, true, !forceSave, false);
if (providerDefinition.Enable) if (providerDefinition.Enable)
{ {
@@ -83,7 +83,7 @@ namespace Radarr.Api.V3
[RestPutById] [RestPutById]
public ActionResult<TProviderResource> UpdateProvider([FromBody] TProviderResource providerResource, [FromQuery] bool forceSave = false) public ActionResult<TProviderResource> UpdateProvider([FromBody] TProviderResource providerResource, [FromQuery] bool forceSave = false)
{ {
var providerDefinition = GetDefinition(providerResource, true, false, false); var providerDefinition = GetDefinition(providerResource, true, !forceSave, false);
// Only test existing definitions if it is enabled and forceSave isn't set. // Only test existing definitions if it is enabled and forceSave isn't set.
if (providerDefinition.Enable && !forceSave) if (providerDefinition.Enable && !forceSave)
@@ -241,7 +241,7 @@ namespace Radarr.Api.V3
protected void VerifyValidationResult(ValidationResult validationResult, bool includeWarnings) protected void VerifyValidationResult(ValidationResult validationResult, bool includeWarnings)
{ {
var result = new NzbDroneValidationResult(validationResult.Errors); var result = validationResult as NzbDroneValidationResult ?? new NzbDroneValidationResult(validationResult.Errors);
if (includeWarnings && (!result.IsValid || result.HasWarnings)) if (includeWarnings && (!result.IsValid || result.HasWarnings))
{ {