diff --git a/frontend/src/Settings/Notifications/Notifications/AddNotificationItem.js b/frontend/src/Settings/Notifications/Notifications/AddNotificationItem.js
index 6d90961b0..bd11b0327 100644
--- a/frontend/src/Settings/Notifications/Notifications/AddNotificationItem.js
+++ b/frontend/src/Settings/Notifications/Notifications/AddNotificationItem.js
@@ -1,10 +1,10 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
-import { sizes } from 'Helpers/Props';
import Button from 'Components/Link/Button';
import Link from 'Components/Link/Link';
import Menu from 'Components/Menu/Menu';
import MenuContent from 'Components/Menu/MenuContent';
+import { sizes } from 'Helpers/Props';
import AddNotificationPresetMenuItem from './AddNotificationPresetMenuItem';
import styles from './AddNotificationItem.css';
@@ -90,7 +90,7 @@ class AddNotificationItem extends Component {
to={infoLink}
size={sizes.SMALL}
>
- More info
+ More Info
diff --git a/frontend/src/Settings/Notifications/Notifications/EditNotificationModalContent.css b/frontend/src/Settings/Notifications/Notifications/EditNotificationModalContent.css
index 5ecf6f5d3..8e1c16507 100644
--- a/frontend/src/Settings/Notifications/Notifications/EditNotificationModalContent.css
+++ b/frontend/src/Settings/Notifications/Notifications/EditNotificationModalContent.css
@@ -9,12 +9,3 @@
margin-bottom: 30px;
}
-
-.triggers {
- margin-top: 3px;
-}
-
-.triggerEvents {
- margin-top: 10px;
- user-select: none;
-}
diff --git a/frontend/src/Settings/Notifications/Notifications/EditNotificationModalContent.js b/frontend/src/Settings/Notifications/Notifications/EditNotificationModalContent.js
index e841ca06e..cfef4dc21 100644
--- a/frontend/src/Settings/Notifications/Notifications/EditNotificationModalContent.js
+++ b/frontend/src/Settings/Notifications/Notifications/EditNotificationModalContent.js
@@ -1,20 +1,20 @@
import PropTypes from 'prop-types';
import React from 'react';
-import { inputTypes, kinds } from 'Helpers/Props';
import Alert from 'Components/Alert';
+import Form from 'Components/Form/Form';
+import FormGroup from 'Components/Form/FormGroup';
+import FormInputGroup from 'Components/Form/FormInputGroup';
+import FormLabel from 'Components/Form/FormLabel';
+import ProviderFieldFormGroup from 'Components/Form/ProviderFieldFormGroup';
import Button from 'Components/Link/Button';
import SpinnerErrorButton from 'Components/Link/SpinnerErrorButton';
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
-import ModalContent from 'Components/Modal/ModalContent';
-import ModalHeader from 'Components/Modal/ModalHeader';
import ModalBody from 'Components/Modal/ModalBody';
+import ModalContent from 'Components/Modal/ModalContent';
import ModalFooter from 'Components/Modal/ModalFooter';
-import Form from 'Components/Form/Form';
-import FormGroup from 'Components/Form/FormGroup';
-import FormLabel from 'Components/Form/FormLabel';
-import FormInputGroup from 'Components/Form/FormInputGroup';
-import FormInputHelpText from 'Components/Form/FormInputHelpText';
-import ProviderFieldFormGroup from 'Components/Form/ProviderFieldFormGroup';
+import ModalHeader from 'Components/Modal/ModalHeader';
+import { inputTypes, kinds } from 'Helpers/Props';
+import NotificationEventItems from './NotificationEventItems';
import styles from './EditNotificationModalContent.css';
function EditNotificationModalContent(props) {
@@ -39,23 +39,6 @@ function EditNotificationModalContent(props) {
id,
implementationName,
name,
- onGrab,
- onDownload,
- onUpgrade,
- onRename,
- onSeriesDelete,
- onEpisodeFileDelete,
- onEpisodeFileDeleteForUpgrade,
- onHealthIssue,
- supportsOnGrab,
- supportsOnDownload,
- supportsOnUpgrade,
- supportsOnRename,
- supportsOnSeriesDelete,
- supportsOnEpisodeFileDelete,
- supportsOnEpisodeFileDeleteForUpgrade,
- supportsOnHealthIssue,
- includeHealthWarnings,
tags,
fields,
message
@@ -75,7 +58,9 @@ function EditNotificationModalContent(props) {
{
!isFetching && !!error &&
-
Unable to add a new notification, please try again.
+
+ Unable to add a new notification, please try again.
+
}
{
@@ -102,111 +87,10 @@ function EditNotificationModalContent(props) {
/>
-
- Triggers
-
-
-
-
-
-
-
-
-
- {
- onDownload.value ?
- :
- null
- }
-
-
-
-
-
-
-
- {
- onEpisodeFileDelete.value ?
- :
- null
- }
-
-
-
- {
- onHealthIssue.value ?
- :
- null
- }
-
-
-
+
Tags
diff --git a/frontend/src/Settings/Notifications/Notifications/EditNotificationModalContentConnector.js b/frontend/src/Settings/Notifications/Notifications/EditNotificationModalContentConnector.js
index 104f1897a..504f18663 100644
--- a/frontend/src/Settings/Notifications/Notifications/EditNotificationModalContentConnector.js
+++ b/frontend/src/Settings/Notifications/Notifications/EditNotificationModalContentConnector.js
@@ -2,8 +2,8 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
+import { saveNotification, setNotificationFieldValue, setNotificationValue, testNotification } from 'Store/Actions/settingsActions';
import createProviderSettingsSelector from 'Store/Selectors/createProviderSettingsSelector';
-import { setNotificationValue, setNotificationFieldValue, saveNotification, testNotification } from 'Store/Actions/settingsActions';
import EditNotificationModalContent from './EditNotificationModalContent';
function createMapStateToProps() {
diff --git a/frontend/src/Settings/Notifications/Notifications/Notification.js b/frontend/src/Settings/Notifications/Notifications/Notification.js
index 7b317d313..89108bd23 100644
--- a/frontend/src/Settings/Notifications/Notifications/Notification.js
+++ b/frontend/src/Settings/Notifications/Notifications/Notification.js
@@ -1,9 +1,9 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
-import { kinds } from 'Helpers/Props';
import Card from 'Components/Card';
import Label from 'Components/Label';
import ConfirmModal from 'Components/Modal/ConfirmModal';
+import { kinds } from 'Helpers/Props';
import EditNotificationModalConnector from './EditNotificationModalConnector';
import styles from './Notification.css';
@@ -39,7 +39,7 @@ class Notification extends Component {
});
}
- onDeleteNotificationModalClose= () => {
+ onDeleteNotificationModalClose = () => {
this.setState({ isDeleteNotificationModalOpen: false });
}
@@ -62,6 +62,7 @@ class Notification extends Component {
onEpisodeFileDelete,
onEpisodeFileDeleteForUpgrade,
onHealthIssue,
+ onApplicationUpdate,
supportsOnGrab,
supportsOnDownload,
supportsOnUpgrade,
@@ -69,7 +70,8 @@ class Notification extends Component {
supportsOnSeriesDelete,
supportsOnEpisodeFileDelete,
supportsOnEpisodeFileDeleteForUpgrade,
- supportsOnHealthIssue
+ supportsOnHealthIssue,
+ supportsOnApplicationUpdate
} = this.props;
return (
@@ -122,6 +124,14 @@ class Notification extends Component {
null
}
+ {
+ supportsOnApplicationUpdate && onApplicationUpdate ?
+ :
+ null
+ }
+
{
supportsOnSeriesDelete && onSeriesDelete ?
+ );
+}
+
+NotificationEventItems.propTypes = {
+ item: PropTypes.object.isRequired,
+ onInputChange: PropTypes.func.isRequired
+};
+
+export default NotificationEventItems;
diff --git a/frontend/src/Settings/Notifications/Notifications/Notifications.js b/frontend/src/Settings/Notifications/Notifications/Notifications.js
index 77a7c11e8..870a66e2a 100644
--- a/frontend/src/Settings/Notifications/Notifications/Notifications.js
+++ b/frontend/src/Settings/Notifications/Notifications/Notifications.js
@@ -1,13 +1,13 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
-import { icons } from 'Helpers/Props';
-import FieldSet from 'Components/FieldSet';
import Card from 'Components/Card';
+import FieldSet from 'Components/FieldSet';
import Icon from 'Components/Icon';
import PageSectionContent from 'Components/Page/PageSectionContent';
-import Notification from './Notification';
+import { icons } from 'Helpers/Props';
import AddNotificationModal from './AddNotificationModal';
import EditNotificationModalConnector from './EditNotificationModalConnector';
+import Notification from './Notification';
import styles from './Notifications.css';
class Notifications extends Component {
diff --git a/frontend/src/Settings/Notifications/Notifications/NotificationsConnector.js b/frontend/src/Settings/Notifications/Notifications/NotificationsConnector.js
index 6f4138627..6191d76f8 100644
--- a/frontend/src/Settings/Notifications/Notifications/NotificationsConnector.js
+++ b/frontend/src/Settings/Notifications/Notifications/NotificationsConnector.js
@@ -2,9 +2,9 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
-import sortByName from 'Utilities/Array/sortByName';
+import { deleteNotification, fetchNotifications } from 'Store/Actions/settingsActions';
import createSortedSectionSelector from 'Store/Selectors/createSortedSectionSelector';
-import { fetchNotifications, deleteNotification } from 'Store/Actions/settingsActions';
+import sortByName from 'Utilities/Array/sortByName';
import Notifications from './Notifications';
function createMapStateToProps() {
diff --git a/frontend/src/Store/Actions/Settings/notifications.js b/frontend/src/Store/Actions/Settings/notifications.js
index 191fd95ef..b7f97abdb 100644
--- a/frontend/src/Store/Actions/Settings/notifications.js
+++ b/frontend/src/Store/Actions/Settings/notifications.js
@@ -109,6 +109,7 @@ export default {
selectedSchema.onSeriesDelete = selectedSchema.supportsOnSeriesDelete;
selectedSchema.onEpisodeFileDelete = selectedSchema.supportsOnEpisodeFileDelete;
selectedSchema.onEpisodeFileDeleteForUpgrade = selectedSchema.supportsOnEpisodeFileDeleteForUpgrade;
+ 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 67327a852..6beb3e805 100644
--- a/src/NzbDrone.Core.Test/NotificationTests/NotificationBaseFixture.cs
+++ b/src/NzbDrone.Core.Test/NotificationTests/NotificationBaseFixture.cs
@@ -79,6 +79,11 @@ namespace NzbDrone.Core.Test.NotificationTests
TestLogger.Info("OnHealthIssue was called");
}
+ public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
+ {
+ TestLogger.Info("OnApplicationUpdate was called");
+ }
+
}
class TestNotificationWithNoEvents : NotificationBase
@@ -92,7 +97,7 @@ namespace NzbDrone.Core.Test.NotificationTests
throw new NotImplementedException();
}
-
+
}
[Test]
@@ -120,6 +125,7 @@ namespace NzbDrone.Core.Test.NotificationTests
notification.SupportsOnEpisodeFileDelete.Should().BeTrue();
notification.SupportsOnEpisodeFileDeleteForUpgrade.Should().BeTrue();
notification.SupportsOnHealthIssue.Should().BeTrue();
+ notification.SupportsOnApplicationUpdate.Should().BeTrue();
}
@@ -136,6 +142,7 @@ namespace NzbDrone.Core.Test.NotificationTests
notification.SupportsOnEpisodeFileDelete.Should().BeFalse();
notification.SupportsOnEpisodeFileDeleteForUpgrade.Should().BeFalse();
notification.SupportsOnHealthIssue.Should().BeFalse();
+ notification.SupportsOnApplicationUpdate.Should().BeFalse();
}
}
diff --git a/src/NzbDrone.Core/Datastore/Migration/165_add_on_update_to_notifications.cs b/src/NzbDrone.Core/Datastore/Migration/165_add_on_update_to_notifications.cs
new file mode 100644
index 000000000..338e4efc1
--- /dev/null
+++ b/src/NzbDrone.Core/Datastore/Migration/165_add_on_update_to_notifications.cs
@@ -0,0 +1,14 @@
+using FluentMigrator;
+using NzbDrone.Core.Datastore.Migration.Framework;
+
+namespace NzbDrone.Core.Datastore.Migration
+{
+ [Migration(165)]
+ 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 5a0de021c..4825a5760 100644
--- a/src/NzbDrone.Core/Datastore/TableMapping.cs
+++ b/src/NzbDrone.Core/Datastore/TableMapping.cs
@@ -76,7 +76,8 @@ namespace NzbDrone.Core.Datastore
.Ignore(i => i.SupportsOnSeriesDelete)
.Ignore(i => i.SupportsOnEpisodeFileDelete)
.Ignore(i => i.SupportsOnEpisodeFileDeleteForUpgrade)
- .Ignore(i => i.SupportsOnHealthIssue);
+ .Ignore(i => i.SupportsOnHealthIssue)
+ .Ignore(i => i.SupportsOnApplicationUpdate);
Mapper.Entity().RegisterDefinition("Metadata")
.Ignore(d => d.Tags);
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 326bc85af..ba4b5b739 100644
--- a/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs
+++ b/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs
@@ -23,7 +23,7 @@ namespace NzbDrone.Core.Notifications.Boxcar
public override void OnDownload(DownloadMessage message)
{
- _proxy.SendNotification(EPISODE_DOWNLOADED_TITLE , message.Message, Settings);
+ _proxy.SendNotification(EPISODE_DOWNLOADED_TITLE, message.Message, Settings);
}
public override void OnEpisodeFileDelete(EpisodeDeleteMessage deleteMessage)
@@ -41,6 +41,10 @@ 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 e70d861b1..01e4f3dba 100644
--- a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs
+++ b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs
@@ -198,6 +198,18 @@ namespace NzbDrone.Core.Notifications.CustomScript
ExecuteScript(environmentVariables);
}
+ public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
+ {
+ var environmentVariables = new StringDictionary();
+
+ environmentVariables.Add("Sonarr_EventType", "ApplicationUpdate");
+ environmentVariables.Add("Sonarr_Update_Message", updateMessage.Message);
+ environmentVariables.Add("Sonarr_Update_NewVersion", updateMessage.NewVersion.ToString());
+ environmentVariables.Add("Sonarr_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 e3af799c6..fb382c508 100644
--- a/src/NzbDrone.Core/Notifications/Discord/Discord.cs
+++ b/src/NzbDrone.Core/Notifications/Discord/Discord.cs
@@ -295,6 +295,40 @@ namespace NzbDrone.Core.Notifications.Discord
_proxy.SendPayload(payload, Settings);
}
+ public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
+ {
+ var attachments = new List