diff --git a/frontend/src/Settings/Notifications/Notifications/Notification.js b/frontend/src/Settings/Notifications/Notifications/Notification.js
index 63df259eb..dc0b428c7 100644
--- a/frontend/src/Settings/Notifications/Notifications/Notification.js
+++ b/frontend/src/Settings/Notifications/Notifications/Notification.js
@@ -67,6 +67,7 @@ class Notification extends Component {
onDownloadFailure,
onImportFailure,
onBookRetag,
+ onApplicationUpdate,
supportsOnGrab,
supportsOnReleaseImport,
supportsOnUpgrade,
@@ -78,7 +79,8 @@ class Notification extends Component {
supportsOnHealthIssue,
supportsOnDownloadFailure,
supportsOnImportFailure,
- supportsOnBookRetag
+ supportsOnBookRetag,
+ supportsOnApplicationUpdate
} = this.props;
return (
@@ -187,6 +189,14 @@ class Notification extends Component {
null
}
+ {
+ supportsOnApplicationUpdate && onApplicationUpdate ?
+ :
+ null
+ }
+
{
!onGrab && !onReleaseImport && !onRename && !onBookRetag && !onHealthIssue && !onDownloadFailure && !onImportFailure ?
+
+
+
+
}
+
diff --git a/frontend/src/Store/Actions/Settings/notifications.js b/frontend/src/Store/Actions/Settings/notifications.js
index 41a155005..166e32a5a 100644
--- a/frontend/src/Store/Actions/Settings/notifications.js
+++ b/frontend/src/Store/Actions/Settings/notifications.js
@@ -114,6 +114,7 @@ export default {
selectedSchema.onDownloadFailure = selectedSchema.supportsOnDownloadFailure;
selectedSchema.onImportFailure = selectedSchema.supportsOnImportFailure;
selectedSchema.onBookRetag = selectedSchema.supportsOnBookRetag;
+ selectedSchema.onApplicationUpdate = selectedSchema.supportsOnApplicationUpdate;
return selectedSchema;
});
diff --git a/src/NzbDrone.Core.Test/NotificationTests/NotificationBaseFixture.cs b/src/NzbDrone.Core.Test/NotificationTests/NotificationBaseFixture.cs
index d3100d5df..5dc996c2e 100644
--- a/src/NzbDrone.Core.Test/NotificationTests/NotificationBaseFixture.cs
+++ b/src/NzbDrone.Core.Test/NotificationTests/NotificationBaseFixture.cs
@@ -96,6 +96,11 @@ public override void OnBookRetag(BookRetagMessage message)
{
TestLogger.Info("OnBookRetag was called");
}
+
+ public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
+ {
+ TestLogger.Info("OnApplicationUpdate was called");
+ }
}
private class TestNotificationWithNoEvents : NotificationBase
@@ -138,6 +143,7 @@ public void should_support_all_if_implemented()
notification.SupportsOnDownloadFailure.Should().BeTrue();
notification.SupportsOnImportFailure.Should().BeTrue();
notification.SupportsOnBookRetag.Should().BeTrue();
+ notification.SupportsOnApplicationUpdate.Should().BeTrue();
}
[Test]
@@ -157,6 +163,7 @@ public void should_support_none_if_none_are_implemented()
notification.SupportsOnDownloadFailure.Should().BeFalse();
notification.SupportsOnImportFailure.Should().BeFalse();
notification.SupportsOnBookRetag.Should().BeFalse();
+ notification.SupportsOnApplicationUpdate.Should().BeFalse();
}
}
}
diff --git a/src/NzbDrone.Core/Datastore/Migration/025_add_on_update_to_notifications.cs b/src/NzbDrone.Core/Datastore/Migration/025_add_on_update_to_notifications.cs
new file mode 100644
index 000000000..85e48bcba
--- /dev/null
+++ b/src/NzbDrone.Core/Datastore/Migration/025_add_on_update_to_notifications.cs
@@ -0,0 +1,14 @@
+using FluentMigrator;
+using NzbDrone.Core.Datastore.Migration.Framework;
+
+namespace NzbDrone.Core.Datastore.Migration
+{
+ [Migration(025)]
+ public class add_on_update_to_notifications : NzbDroneMigrationBase
+ {
+ protected override void MainDbUpgrade()
+ {
+ Alter.Table("Notifications").AddColumn("OnApplicationUpdate").AsBoolean().WithDefaultValue(true);
+ }
+ }
+}
diff --git a/src/NzbDrone.Core/Datastore/TableMapping.cs b/src/NzbDrone.Core/Datastore/TableMapping.cs
index 2012f04d6..1e8d24d45 100644
--- a/src/NzbDrone.Core/Datastore/TableMapping.cs
+++ b/src/NzbDrone.Core/Datastore/TableMapping.cs
@@ -90,7 +90,8 @@ public static void Map()
.Ignore(i => i.SupportsOnHealthIssue)
.Ignore(i => i.SupportsOnDownloadFailure)
.Ignore(i => i.SupportsOnImportFailure)
- .Ignore(i => i.SupportsOnBookRetag);
+ .Ignore(i => i.SupportsOnBookRetag)
+ .Ignore(i => i.SupportsOnApplicationUpdate);
Mapper.Entity("Metadata").RegisterModel()
.Ignore(x => x.ImplementationName)
diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json
index aac37b652..bd2e82d9e 100644
--- a/src/NzbDrone.Core/Localization/Core/en.json
+++ b/src/NzbDrone.Core/Localization/Core/en.json
@@ -497,6 +497,8 @@
"OnBookFileDeleteHelpText": "On Book File Delete",
"OnBookRetagHelpText": "On Book Retag",
"OnBookTagUpdate": "On Book Tag Update",
+ "OnApplicationUpdate": "On Application Update",
+ "OnApplicationUpdateHelpText": "On Application Update",
"OnDownloadFailure": "On Download Failure",
"OnDownloadFailureHelpText": "On Download Failure",
"OnGrab": "On Grab",
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 033c24c71..2fb698ab7 100644
--- a/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs
+++ b/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs
@@ -56,6 +56,11 @@ public override void OnImportFailure(BookDownloadMessage message)
_proxy.SendNotification(IMPORT_FAILURE_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 ce6bab057..d3f3aae47 100644
--- a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs
+++ b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs
@@ -214,6 +214,18 @@ public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
ExecuteScript(environmentVariables);
}
+ public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
+ {
+ var environmentVariables = new StringDictionary();
+
+ environmentVariables.Add("Readarr_EventType", "ApplicationUpdate");
+ environmentVariables.Add("Readarr_Update_Message", updateMessage.Message);
+ environmentVariables.Add("Readarr_Update_NewVersion", updateMessage.NewVersion.ToString());
+ environmentVariables.Add("Readarr_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 89429f7c7..31cbd69a6 100644
--- a/src/NzbDrone.Core/Notifications/Discord/Discord.cs
+++ b/src/NzbDrone.Core/Notifications/Discord/Discord.cs
@@ -184,6 +184,41 @@ public override void OnImportFailure(BookDownloadMessage message)
_proxy.SendPayload(payload, Settings);
}
+ public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
+ {
+ var attachments = new List