Fixed: Record status for notifications on tests

pull/1920/head
Bogdan 1 year ago
parent 6969326092
commit 493114f4e8

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using FluentValidation.Results;
using NLog; using NLog;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
@ -97,5 +98,26 @@ namespace NzbDrone.Core.Notifications
definition.SupportsOnHealthRestored = provider.SupportsOnHealthRestored; definition.SupportsOnHealthRestored = provider.SupportsOnHealthRestored;
definition.SupportsOnApplicationUpdate = provider.SupportsOnApplicationUpdate; definition.SupportsOnApplicationUpdate = provider.SupportsOnApplicationUpdate;
} }
public override ValidationResult Test(NotificationDefinition definition)
{
var result = base.Test(definition);
if (definition.Id == 0)
{
return result;
}
if (result == null || result.IsValid)
{
_notificationStatusService.RecordSuccess(definition.Id);
}
else
{
_notificationStatusService.RecordFailure(definition.Id);
}
return result;
}
} }
} }

Loading…
Cancel
Save