From c90d010cd806d41e469a03b910803e3bb72ad4d8 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 22 Nov 2013 08:59:03 -0800 Subject: [PATCH] Fixed the broken tests --- src/NzbDrone.Api/Config/NamingModule.cs | 9 ++++++++- src/NzbDrone.Core/Organizer/FileNameBuilder.cs | 5 +++++ .../MediaManagement/Naming/Basic/BasicNamingView.js | 3 +-- src/UI/Settings/MediaManagement/Naming/NamingView.js | 4 ++-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Api/Config/NamingModule.cs b/src/NzbDrone.Api/Config/NamingModule.cs index 4daad949e..3e6b8efe0 100644 --- a/src/NzbDrone.Api/Config/NamingModule.cs +++ b/src/NzbDrone.Api/Config/NamingModule.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using FluentValidation; using FluentValidation.Results; @@ -56,6 +57,12 @@ namespace NzbDrone.Api.Config { var nameSpec = _namingConfigService.GetConfig(); var resource = nameSpec.InjectTo(); + + if (String.IsNullOrWhiteSpace(resource.StandardEpisodeFormat)) + { + return resource; + } + var basicConfig = _filenameBuilder.GetBasicNamingConfig(nameSpec); resource.InjectFrom(basicConfig); diff --git a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs index 618f22ea5..776f138df 100644 --- a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs +++ b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs @@ -181,6 +181,11 @@ namespace NzbDrone.Core.Organizer { var episodeFormat = GetEpisodeFormat(nameSpec.StandardEpisodeFormat); + if (episodeFormat == null) + { + return new BasicNamingConfig(); + } + var basicNamingConfig = new BasicNamingConfig { Separator = episodeFormat.Separator, diff --git a/src/UI/Settings/MediaManagement/Naming/Basic/BasicNamingView.js b/src/UI/Settings/MediaManagement/Naming/Basic/BasicNamingView.js index 616a20483..29f14a74a 100644 --- a/src/UI/Settings/MediaManagement/Naming/Basic/BasicNamingView.js +++ b/src/UI/Settings/MediaManagement/Naming/Basic/BasicNamingView.js @@ -5,9 +5,8 @@ define( 'vent', 'marionette', 'Settings/MediaManagement/Naming/NamingSampleModel', - 'Settings/MediaManagement/Naming/Wizard/NamingWizardModel', 'Mixins/AsModelBoundView' - ], function (_, vent, Marionette, NamingSampleModel, NamingWizardModel, AsModelBoundView) { + ], function (_, vent, Marionette, NamingSampleModel, AsModelBoundView) { var view = Marionette.ItemView.extend({ template: 'Settings/MediaManagement/Naming/Basic/BasicNamingViewTemplate', diff --git a/src/UI/Settings/MediaManagement/Naming/NamingView.js b/src/UI/Settings/MediaManagement/Naming/NamingView.js index 7d50f9cf8..a9ad9e7e9 100644 --- a/src/UI/Settings/MediaManagement/Naming/NamingView.js +++ b/src/UI/Settings/MediaManagement/Naming/NamingView.js @@ -37,8 +37,8 @@ define( this.ui.namingOptions.hide(); } - this.basicNamingView = new BasicNamingView({ model: this.model }); - this.basicNamingRegion.show(this.basicNamingView); + var basicNamingView = new BasicNamingView({ model: this.model }); + this.basicNamingRegion.show(basicNamingView); this.namingSampleModel = new NamingSampleModel(); this.listenTo(this.model, 'change', this._updateSamples);