diff --git a/PlexRequests.Core/SettingModels/EmailNotificationSettings.cs b/PlexRequests.Core/SettingModels/EmailNotificationSettings.cs index 6a151e861..74cb7ec92 100644 --- a/PlexRequests.Core/SettingModels/EmailNotificationSettings.cs +++ b/PlexRequests.Core/SettingModels/EmailNotificationSettings.cs @@ -1,14 +1,41 @@ -namespace PlexRequests.Core.SettingModels +#region Copyright +// /************************************************************************ +// Copyright (c) 2016 Jamie Rees +// File: EmailNotificationSettings.cs +// Created By: Jamie Rees +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// ************************************************************************/ +#endregion +namespace PlexRequests.Core.SettingModels { public class EmailNotificationSettings : Settings { public string EmailHost { get; set; } + public string EmailPassword { get; set; } public int EmailPort { get; set; } - public bool Ssl { get; set; } - public string RecipientEmail { get; set; } public string EmailSender { get; set; } public string EmailUsername { get; set; } - public string EmailPassword { get; set; } public bool Enabled { get; set; } + public bool EnableUserEmailNotifications { get; set; } + public string RecipientEmail { get; set; } + public bool Ssl { get; set; } } } \ No newline at end of file diff --git a/PlexRequests.UI/Modules/SearchModule.cs b/PlexRequests.UI/Modules/SearchModule.cs index 99150f4c8..e6e47cc6e 100644 --- a/PlexRequests.UI/Modules/SearchModule.cs +++ b/PlexRequests.UI/Modules/SearchModule.cs @@ -163,10 +163,10 @@ namespace PlexRequests.UI.Modules private Response ProcessMovies(MovieSearchType searchType, string searchTerm) { - List taskList = new List(); + var taskList = new List(); - List apiMovies = new List(); - taskList.Add(Task.Factory.StartNew>(() => + var apiMovies = new List(); + taskList.Add(Task.Factory.StartNew(() => { switch(searchType) { @@ -212,13 +212,13 @@ namespace PlexRequests.UI.Modules Task.WaitAll(taskList.ToArray()); - int[] cpCached = CpCacher.QueuedIds(); + var cpCached = CpCacher.QueuedIds(); var plexMovies = Checker.GetPlexMovies(); - List viewMovies = new List(); + var viewMovies = new List(); foreach (MovieResult movie in apiMovies) { - var viewMovie = new SearchMovieViewModel() + var viewMovie = new SearchMovieViewModel { Adult = movie.Adult, BackdropPath = movie.BackdropPath, @@ -293,8 +293,8 @@ namespace PlexRequests.UI.Modules return Response.AsJson(""); } - int[] sonarrCached = SonarrCacher.QueuedIds(); - int[] sickRageCache = SickRageCacher.QueuedIds(); // consider just merging sonarr/sickrage arrays + var sonarrCached = SonarrCacher.QueuedIds(); + var sickRageCache = SickRageCacher.QueuedIds(); // consider just merging sonarr/sickrage arrays var plexTvShows = Checker.GetPlexTvShows(); var viewTv = new List(); @@ -322,7 +322,7 @@ namespace PlexRequests.UI.Modules { viewT.Available = true; } - else if (t.show.externals.thetvdb != null) + else if (t.show?.externals?.thetvdb != null) { int tvdbid = (int)t.show.externals.thetvdb; @@ -350,9 +350,9 @@ namespace PlexRequests.UI.Modules private Response SearchMusic(string searchTerm) { - List taskList = new List(); + var taskList = new List(); - List apiAlbums = new List(); + var apiAlbums = new List(); taskList.Add(Task.Factory.StartNew(() => { return MusicBrainzApi.SearchAlbum(searchTerm); @@ -362,7 +362,7 @@ namespace PlexRequests.UI.Modules apiAlbums = t.Result.releases ?? new List(); })); - Dictionary dbAlbum = new Dictionary(); + var dbAlbum = new Dictionary(); taskList.Add(Task.Factory.StartNew(() => { return RequestService.GetAll().Where(x => x.Type == RequestType.Album); @@ -486,7 +486,7 @@ namespace PlexRequests.UI.Modules if (result) { model.Approved = true; - Log.Debug("Adding movie to database requests (No approval required)"); + Log.Info("Adding movie to database (No approval required)"); RequestService.AddRequest(model); var notificationModel = new NotificationModel @@ -511,7 +511,7 @@ namespace PlexRequests.UI.Modules else { model.Approved = true; - Log.Debug("Adding movie to database requests (No approval required)"); + Log.Info("Adding movie to database (No approval required)"); RequestService.AddRequest(model); var notificationModel = new NotificationModel @@ -529,7 +529,7 @@ namespace PlexRequests.UI.Modules try { - Log.Debug("Adding movie to database requests"); + Log.Info("Adding movie to database"); var id = RequestService.AddRequest(model); var notificationModel = new NotificationModel { Title = model.Title, User = Username, DateTime = DateTime.Now, NotificationType = NotificationType.NewRequest }; diff --git a/PlexRequests.UI/Views/Admin/EmailNotifications.cshtml b/PlexRequests.UI/Views/Admin/EmailNotifications.cshtml index 45fda1a0e..978283d2c 100644 --- a/PlexRequests.UI/Views/Admin/EmailNotifications.cshtml +++ b/PlexRequests.UI/Views/Admin/EmailNotifications.cshtml @@ -45,7 +45,22 @@
- +
+ +
+
+ Please note that if user notifications is enabled, the email will get sent with the SMTP set-up below. +
+