diff --git a/Ombi.Core/SettingModels/EmailNotificationSettings.cs b/Ombi.Core/SettingModels/EmailNotificationSettings.cs index 65f55a61a..672588922 100644 --- a/Ombi.Core/SettingModels/EmailNotificationSettings.cs +++ b/Ombi.Core/SettingModels/EmailNotificationSettings.cs @@ -34,7 +34,6 @@ namespace Ombi.Core.SettingModels public string EmailSender { get; set; } public string EmailUsername { get; set; } public bool Authentication { get; set; } - public bool EnableUserEmailNotifications { get; set; } public string RecipientEmail { get; set; } } } \ No newline at end of file diff --git a/Ombi.Services/Jobs/RadarrCacher.cs b/Ombi.Services/Jobs/RadarrCacher.cs index 7273fb626..fc7338ecf 100644 --- a/Ombi.Services/Jobs/RadarrCacher.cs +++ b/Ombi.Services/Jobs/RadarrCacher.cs @@ -66,7 +66,15 @@ namespace Ombi.Services.Jobs var movies = RadarrApi.GetMovies(settings.ApiKey, settings.FullUri); if (movies != null) { - var movieIds = movies.Select(x => x.tmdbId).ToList(); + var movieIds = new List(); + foreach (var m in movies) + { + if (m.tmdbId > 0) + { + movieIds.Add(m.tmdbId); + } + } + //var movieIds = movies.Select(x => x.tmdbId).ToList(); Cache.Set(CacheKeys.RadarrMovies, movieIds, CacheKeys.TimeFrameMinutes.SchedulerCaching); } } diff --git a/Ombi.Services/Notification/EmailMessageNotification.cs b/Ombi.Services/Notification/EmailMessageNotification.cs index 1de8ef7e6..729726eef 100644 --- a/Ombi.Services/Notification/EmailMessageNotification.cs +++ b/Ombi.Services/Notification/EmailMessageNotification.cs @@ -119,14 +119,6 @@ namespace Ombi.Services.Notification return false; } - if (!settings.EnableUserEmailNotifications) - { - if (!settings.Enabled) - { - return false; - } - } - return true; } @@ -237,10 +229,6 @@ namespace Ombi.Services.Notification private async Task EmailAvailableRequest(NotificationModel model, EmailNotificationSettings settings) { - if (!settings.EnableUserEmailNotifications) - { - await Task.FromResult(false); - } var email = new EmailBasicTemplate(); var html = email.LoadTemplate( $"Ombi: {model.Title} is now available!", diff --git a/Ombi.UI/Modules/Admin/AdminModule.cs b/Ombi.UI/Modules/Admin/AdminModule.cs index 0a6f1c7e0..97a610441 100644 --- a/Ombi.UI/Modules/Admin/AdminModule.cs +++ b/Ombi.UI/Modules/Admin/AdminModule.cs @@ -211,8 +211,8 @@ namespace Ombi.UI.Modules.Admin Get["/headphones"] = _ => Headphones(); Post["/headphones"] = _ => SaveHeadphones(); - Get["/newsletter"] = _ => Newsletter(); - Post["/newsletter"] = _ => SaveNewsletter(); + Get["/newsletter", true] = async (x, ct) => await Newsletter(); + Post["/newsletter", true] = async (x, ct) => await SaveNewsletter(); Post["/createapikey"] = x => CreateApiKey(); @@ -845,13 +845,13 @@ namespace Ombi.UI.Modules.Admin : new JsonResponseModel { Result = false, Message = "Could not update the settings, take a look at the logs." }); } - private Negotiator Newsletter() + private async Task Newsletter() { - var settings = NewsLetterService.GetSettings(); + var settings = await NewsLetterService.GetSettingsAsync(); return View["NewsletterSettings", settings]; } - private Response SaveNewsletter() + private async Task SaveNewsletter() { var settings = this.Bind(); @@ -859,9 +859,17 @@ namespace Ombi.UI.Modules.Admin if (!valid.IsValid) { var error = valid.SendJsonError(); - Log.Info("Error validating Headphones settings, message: {0}", error.Message); + Log.Info("Error validating Newsletter settings, message: {0}", error.Message); return Response.AsJson(error); } + + // Make sure emails are setup + var emailSettings = await EmailService.GetSettingsAsync(); + if (!emailSettings.Enabled) + { + return Response.AsJson(new JsonResponseModel { Result = false, Message = "Please enable your email notifications" }); + } + settings.SendRecentlyAddedEmail = settings.SendRecentlyAddedEmail; var result = NewsLetterService.SaveSettings(settings); diff --git a/Ombi.UI/Views/Admin/EmailNotifications.cshtml b/Ombi.UI/Views/Admin/EmailNotifications.cshtml index 3dfee8f8b..f2d7aab82 100644 --- a/Ombi.UI/Views/Admin/EmailNotifications.cshtml +++ b/Ombi.UI/Views/Admin/EmailNotifications.cshtml @@ -31,20 +31,7 @@ -
-
- @if (Model.EnableUserEmailNotifications) - { - - } - else - { - - } - -
-
@@ -59,7 +46,7 @@
- Please note that if user notifications is enabled, the email will get sent with the SMTP set-up below. +
@@ -82,12 +69,15 @@
+ + The sender is who the email will be sent from, this can be for any email including user notification emails (if that is enabled).
+ The recipient email is used for emails going to the administrator. diff --git a/Ombi.UI/Views/Admin/NewsletterSettings.cshtml b/Ombi.UI/Views/Admin/NewsletterSettings.cshtml index 37ed9d27c..8b0d462ff 100644 --- a/Ombi.UI/Views/Admin/NewsletterSettings.cshtml +++ b/Ombi.UI/Views/Admin/NewsletterSettings.cshtml @@ -16,35 +16,20 @@
@if (Model.SendRecentlyAddedEmail) { - + } else { - + } - -
-
- @if (Model.SendToPlexUsers) - { - - } - else - { - - } - -
-

-
- + You can add multiple email address by using the ; delimiter
diff --git a/Ombi.UI/Views/Customization/Customization.cshtml b/Ombi.UI/Views/Customization/Customization.cshtml index d7b44f2fa..583dbabae 100644 --- a/Ombi.UI/Views/Customization/Customization.cshtml +++ b/Ombi.UI/Views/Customization/Customization.cshtml @@ -40,7 +40,6 @@
- @Html.Checkbox(Model.Settings.NewSearch, "NewSearch", "Use New Search")
@@ -105,6 +104,7 @@
+ @Html.Checkbox(Model.Settings.NewSearch, "NewSearch", "Use New Search")