From 8b8ee912c0b4d4e3d12b4760639d963dbac30429 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 13 Jun 2013 08:21:38 -0700 Subject: [PATCH] Fixed up per comments --- NzbDrone.Api/Notifications/NotificationModule.cs | 2 +- NzbDrone.Api/Notifications/NotificationResource.cs | 2 +- NzbDrone.Api/Notifications/NotificationSchemaModule.cs | 2 +- UI/Commands/CommandController.js | 2 +- UI/Settings/Notifications/EditView.js | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/NzbDrone.Api/Notifications/NotificationModule.cs b/NzbDrone.Api/Notifications/NotificationModule.cs index da14fbedc..2279a8623 100644 --- a/NzbDrone.Api/Notifications/NotificationModule.cs +++ b/NzbDrone.Api/Notifications/NotificationModule.cs @@ -34,7 +34,7 @@ private List GetAll() var notificationResource = new NotificationResource(); notificationResource.InjectFrom(notification); notificationResource.Fields = SchemaBuilder.GenerateSchema(notification.Settings); - notificationResource.Command = String.Format("test{0}", notification.Implementation.ToLowerInvariant()); + notificationResource.TestCommand = String.Format("test{0}", notification.Implementation.ToLowerInvariant()); result.Add(notificationResource); } diff --git a/NzbDrone.Api/Notifications/NotificationResource.cs b/NzbDrone.Api/Notifications/NotificationResource.cs index 05a9c0162..1406571e5 100644 --- a/NzbDrone.Api/Notifications/NotificationResource.cs +++ b/NzbDrone.Api/Notifications/NotificationResource.cs @@ -13,6 +13,6 @@ public class NotificationResource : RestResource public Boolean OnDownload { get; set; } public List Fields { get; set; } public String Implementation { get; set; } - public String Command { get; set; } + public String TestCommand { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Api/Notifications/NotificationSchemaModule.cs b/NzbDrone.Api/Notifications/NotificationSchemaModule.cs index 229d69e1a..e838f62f8 100644 --- a/NzbDrone.Api/Notifications/NotificationSchemaModule.cs +++ b/NzbDrone.Api/Notifications/NotificationSchemaModule.cs @@ -31,7 +31,7 @@ private List GetSchema() var notificationResource = new NotificationResource(); notificationResource.InjectFrom(notification); notificationResource.Fields = SchemaBuilder.GenerateSchema(notification.Settings); - notificationResource.Command = String.Format("test{0}", notification.Implementation.ToLowerInvariant()); + notificationResource.TestCommand = String.Format("test{0}", notification.Implementation.ToLowerInvariant()); result.Add(notificationResource); } diff --git a/UI/Commands/CommandController.js b/UI/Commands/CommandController.js index 535fa3c28..ce22c5a6e 100644 --- a/UI/Commands/CommandController.js +++ b/UI/Commands/CommandController.js @@ -4,7 +4,7 @@ define(['app'], function () { NzbDrone.Commands.Execute = function (name, properties) { var data = { command: name }; - if (properties !== undefined) { + if (!properties) { $.extend(data, properties); } diff --git a/UI/Settings/Notifications/EditView.js b/UI/Settings/Notifications/EditView.js index b3ea0442f..7e93901b8 100644 --- a/UI/Settings/Notifications/EditView.js +++ b/UI/Settings/Notifications/EditView.js @@ -49,8 +49,8 @@ define([ }, _test: function () { - var command = this.model.get('command'); - if (command) { + var testCommand = this.model.get('testCommand'); + if (testCommand) { this.idle = false; this.ui.testButton.addClass('disabled'); this.ui.testIcon.removeClass('icon-question'); @@ -58,12 +58,12 @@ define([ var properties = {}; - _.each(this.model.attributes.fields, function (field) { + _.each(this.model.get('fields'), function (field) { properties[field.name] = field.value; }); var self = this; - var commandPromise = NzbDrone.Commands.Execute(command, properties); + var commandPromise = NzbDrone.Commands.Execute(testCommand, properties); commandPromise.done(function () { NzbDrone.Shared.Messenger.show({ message: 'Notification settings tested successfully'