diff --git a/frontend/src/Settings/Notifications/Notifications/Notification.js b/frontend/src/Settings/Notifications/Notifications/Notification.js
index e356024c4..e4a2847d9 100644
--- a/frontend/src/Settings/Notifications/Notifications/Notification.js
+++ b/frontend/src/Settings/Notifications/Notifications/Notification.js
@@ -40,7 +40,7 @@ class Notification extends Component {
});
};
- onDeleteNotificationModalClose= () => {
+ onDeleteNotificationModalClose = () => {
this.setState({ isDeleteNotificationModalOpen: false });
};
@@ -61,12 +61,14 @@ class Notification extends Component {
onRename,
onDelete,
onHealthIssue,
+ onApplicationUpdate,
supportsOnGrab,
supportsOnDownload,
supportsOnUpgrade,
supportsOnRename,
supportsOnDelete,
- supportsOnHealthIssue
+ supportsOnHealthIssue,
+ supportsOnApplicationUpdate
} = this.props;
return (
@@ -82,53 +84,62 @@ class Notification extends Component {
{
supportsOnGrab && onGrab &&
}
{
supportsOnDelete && onDelete &&
}
{
supportsOnDownload && onDownload &&
}
{
supportsOnUpgrade && onDownload && onUpgrade &&
}
{
supportsOnRename && onRename &&
}
{
supportsOnHealthIssue && onHealthIssue &&
}
{
- !onGrab && !onDownload && !onRename && !onHealthIssue && !onDelete &&
+ supportsOnApplicationUpdate && onApplicationUpdate ?
+ :
+ null
+ }
+
+ {
+ !onGrab && !onDownload && !onRename && !onHealthIssue && !onDelete && !onApplicationUpdate ?
+ {translate('Disabled')}
+ :
+ null
}
}
+
+
+
+
diff --git a/frontend/src/Store/Actions/Settings/notifications.js b/frontend/src/Store/Actions/Settings/notifications.js
index 062fe4d9e..c9c86a2a8 100644
--- a/frontend/src/Store/Actions/Settings/notifications.js
+++ b/frontend/src/Store/Actions/Settings/notifications.js
@@ -106,6 +106,7 @@ export default {
selectedSchema.onDownload = selectedSchema.supportsOnDownload;
selectedSchema.onUpgrade = selectedSchema.supportsOnUpgrade;
selectedSchema.onRename = selectedSchema.supportsOnRename;
+ selectedSchema.onApplicationUpdate = selectedSchema.supportsOnApplicationUpdate;
return selectedSchema;
});
diff --git a/src/NzbDrone.Core.Test/NotificationTests/NotificationBaseFixture.cs b/src/NzbDrone.Core.Test/NotificationTests/NotificationBaseFixture.cs
new file mode 100644
index 000000000..35fe385e8
--- /dev/null
+++ b/src/NzbDrone.Core.Test/NotificationTests/NotificationBaseFixture.cs
@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+using FluentAssertions;
+using FluentValidation.Results;
+using NUnit.Framework;
+using NzbDrone.Core.Notifications;
+using NzbDrone.Core.ThingiProvider;
+using NzbDrone.Core.Validation;
+using NzbDrone.Test.Common;
+
+namespace NzbDrone.Core.Test.NotificationTests
+{
+ [TestFixture]
+ public class NotificationBaseFixture : TestBase
+ {
+ private class TestSetting : IProviderConfig
+ {
+ public NzbDroneValidationResult Validate()
+ {
+ return new NzbDroneValidationResult();
+ }
+ }
+
+ private class TestNotificationWithApplicationUpdate : NotificationBase
+ {
+ public override string Name => "TestNotification";
+ public override string Link => "";
+
+ public override ValidationResult Test()
+ {
+ throw new NotImplementedException();
+ }
+
+ public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
+ {
+ TestLogger.Info("OnApplicationUpdate was called");
+ }
+ }
+
+ private class TestNotificationWithAllEvents : NotificationBase
+ {
+ public override string Name => "TestNotification";
+ public override string Link => "";
+
+ public override ValidationResult Test()
+ {
+ throw new NotImplementedException();
+ }
+
+ public override void OnHealthIssue(NzbDrone.Core.HealthCheck.HealthCheck artist)
+ {
+ TestLogger.Info("OnHealthIssue was called");
+ }
+
+ public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
+ {
+ TestLogger.Info("OnApplicationUpdate was called");
+ }
+ }
+
+ private class TestNotificationWithNoEvents : NotificationBase
+ {
+ public override string Name => "TestNotification";
+ public override string Link => "";
+
+ public override ValidationResult Test()
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ [Test]
+ public void should_support_all_if_implemented()
+ {
+ var notification = new TestNotificationWithAllEvents();
+
+ notification.SupportsOnHealthIssue.Should().BeTrue();
+ notification.SupportsOnApplicationUpdate.Should().BeTrue();
+ }
+
+ [Test]
+ public void should_support_none_if_none_are_implemented()
+ {
+ var notification = new TestNotificationWithNoEvents();
+
+ notification.SupportsOnHealthIssue.Should().BeFalse();
+ notification.SupportsOnApplicationUpdate.Should().BeFalse();
+ }
+ }
+}
diff --git a/src/NzbDrone.Core/Datastore/Migration/014_add_on_update_to_notifications.cs b/src/NzbDrone.Core/Datastore/Migration/014_add_on_update_to_notifications.cs
new file mode 100644
index 000000000..3fc05561a
--- /dev/null
+++ b/src/NzbDrone.Core/Datastore/Migration/014_add_on_update_to_notifications.cs
@@ -0,0 +1,14 @@
+using FluentMigrator;
+using NzbDrone.Core.Datastore.Migration.Framework;
+
+namespace NzbDrone.Core.Datastore.Migration
+{
+ [Migration(014)]
+ public class add_on_update_to_notifications : NzbDroneMigrationBase
+ {
+ protected override void MainDbUpgrade()
+ {
+ Alter.Table("Notifications").AddColumn("OnApplicationUpdate").AsBoolean().WithDefaultValue(0);
+ }
+ }
+}
diff --git a/src/NzbDrone.Core/Datastore/TableMapping.cs b/src/NzbDrone.Core/Datastore/TableMapping.cs
index 74e6c6b28..7942732d6 100644
--- a/src/NzbDrone.Core/Datastore/TableMapping.cs
+++ b/src/NzbDrone.Core/Datastore/TableMapping.cs
@@ -63,7 +63,8 @@ namespace NzbDrone.Core.Datastore
Mapper.Entity("Notifications").RegisterModel()
.Ignore(x => x.ImplementationName)
- .Ignore(i => i.SupportsOnHealthIssue);
+ .Ignore(i => i.SupportsOnHealthIssue)
+ .Ignore(i => i.SupportsOnApplicationUpdate);
Mapper.Entity("IndexerProxies").RegisterModel()
.Ignore(x => x.ImplementationName);
diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json
index 16f81c7b7..f8b175d7d 100644
--- a/src/NzbDrone.Core/Localization/Core/en.json
+++ b/src/NzbDrone.Core/Localization/Core/en.json
@@ -262,6 +262,9 @@
"NoUpdatesAreAvailable": "No updates are available",
"OAuthPopupMessage": "Pop-ups are being blocked by your browser",
"Ok": "Ok",
+ "OnApplicationUpdate": "On Application Update",
+ "OnApplicationUpdateHelpText": "On Application Update",
+ "OnHealthIssue": "On Health Issue",
"OnHealthIssueHelpText": "On Health Issue",
"OpenBrowserOnStart": "Open browser on start",
"OpenThisModal": "Open This Modal",
diff --git a/src/NzbDrone.Core/Notifications/ApplicationUpdateMessage.cs b/src/NzbDrone.Core/Notifications/ApplicationUpdateMessage.cs
new file mode 100644
index 000000000..1819ad423
--- /dev/null
+++ b/src/NzbDrone.Core/Notifications/ApplicationUpdateMessage.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace NzbDrone.Core.Notifications
+{
+ public class ApplicationUpdateMessage
+ {
+ public string Message { get; set; }
+ public Version PreviousVersion { get; set; }
+ public Version NewVersion { get; set; }
+
+ public override string ToString()
+ {
+ return NewVersion.ToString();
+ }
+ }
+}
diff --git a/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs b/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs
index dedf30421..db6908019 100644
--- a/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs
+++ b/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs
@@ -20,6 +20,11 @@ namespace NzbDrone.Core.Notifications.Boxcar
_proxy.SendNotification(HEALTH_ISSUE_TITLE, message.Message, Settings);
}
+ public override void OnApplicationUpdate(ApplicationUpdateMessage message)
+ {
+ _proxy.SendNotification(APPLICATION_UPDATE_TITLE, message.Message, Settings);
+ }
+
public override ValidationResult Test()
{
var failures = new List();
diff --git a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs
index 83130cd53..f7d728ca3 100755
--- a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs
+++ b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs
@@ -44,6 +44,18 @@ namespace NzbDrone.Core.Notifications.CustomScript
ExecuteScript(environmentVariables);
}
+ public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
+ {
+ var environmentVariables = new StringDictionary();
+
+ environmentVariables.Add("Prowlarr_EventType", "ApplicationUpdate");
+ environmentVariables.Add("Prowlarr_Update_Message", updateMessage.Message);
+ environmentVariables.Add("Prowlarr_Update_NewVersion", updateMessage.NewVersion.ToString());
+ environmentVariables.Add("Prowlarr_Update_PreviousVersion", updateMessage.PreviousVersion.ToString());
+
+ ExecuteScript(environmentVariables);
+ }
+
public override ValidationResult Test()
{
var failures = new List();
diff --git a/src/NzbDrone.Core/Notifications/Discord/Discord.cs b/src/NzbDrone.Core/Notifications/Discord/Discord.cs
index 414d784fe..2985af45a 100644
--- a/src/NzbDrone.Core/Notifications/Discord/Discord.cs
+++ b/src/NzbDrone.Core/Notifications/Discord/Discord.cs
@@ -42,6 +42,41 @@ namespace NzbDrone.Core.Notifications.Discord
_proxy.SendPayload(payload, Settings);
}
+ public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
+ {
+ var attachments = new List