From acb62f476882307ee8f11981e2a7e064ed5d4a58 Mon Sep 17 00:00:00 2001 From: Jamie Date: Fri, 6 Apr 2018 21:36:54 +0100 Subject: [PATCH] Added the ability to turn off TV or Movies from the newsletter --- src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs | 6 +++--- .../Models/Notifications/NewsletterSettings.cs | 2 ++ .../ClientApp/app/interfaces/INotificationSettings.ts | 2 ++ .../settings/notifications/newsletter.component.html | 10 ++++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs b/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs index d8629e410..28db7bff2 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs @@ -229,20 +229,20 @@ namespace Ombi.Schedule.Jobs.Ombi return resolver.ParseMessage(template, curlys); } - private async Task BuildHtml(IQueryable plexContentToSend, IQueryable embyContentToSend, IQueryable plexEpisodes, IQueryable embyEp) + private async Task BuildHtml(IQueryable plexContentToSend, IQueryable embyContentToSend, IQueryable plexEpisodes, IQueryable embyEp, NewsletterSettings settings) { var sb = new StringBuilder(); var plexMovies = plexContentToSend.Where(x => x.Type == PlexMediaTypeEntity.Movie); var embyMovies = embyContentToSend.Where(x => x.Type == EmbyMediaType.Movie); - if (plexMovies.Any() || embyMovies.Any()) + if ((plexMovies.Any() || embyMovies.Any()) && !settings.DisableMovies) { sb.Append("

New Movies:



"); await ProcessPlexMovies(plexMovies, sb); await ProcessEmbyMovies(embyMovies, sb); } - if (plexEpisodes.Any() || embyEp.Any()) + if ((plexEpisodes.Any() || embyEp.Any()) && !settings.DisableTv) { sb.Append("

New Episodes:



"); await ProcessPlexTv(plexEpisodes, sb); diff --git a/src/Ombi.Settings/Settings/Models/Notifications/NewsletterSettings.cs b/src/Ombi.Settings/Settings/Models/Notifications/NewsletterSettings.cs index 380e2d743..0fed1418e 100644 --- a/src/Ombi.Settings/Settings/Models/Notifications/NewsletterSettings.cs +++ b/src/Ombi.Settings/Settings/Models/Notifications/NewsletterSettings.cs @@ -2,6 +2,8 @@ { public class NewsletterSettings : Settings { + public bool DisableTv { get; set; } + public bool DisableMovies { get; set; } public bool Enabled { get; set; } } } \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/interfaces/INotificationSettings.ts b/src/Ombi/ClientApp/app/interfaces/INotificationSettings.ts index a7944f1a2..5105ef13c 100644 --- a/src/Ombi/ClientApp/app/interfaces/INotificationSettings.ts +++ b/src/Ombi/ClientApp/app/interfaces/INotificationSettings.ts @@ -57,6 +57,8 @@ export interface IDiscordNotifcationSettings extends INotificationSettings { export interface INewsletterNotificationSettings extends INotificationSettings { notificationTemplate: INotificationTemplates; + disableMovies: boolean; + disableTv: boolean; } export interface ITelegramNotifcationSettings extends INotificationSettings { diff --git a/src/Ombi/ClientApp/app/settings/notifications/newsletter.component.html b/src/Ombi/ClientApp/app/settings/notifications/newsletter.component.html index 19ab565b6..b2c9ea179 100644 --- a/src/Ombi/ClientApp/app/settings/notifications/newsletter.component.html +++ b/src/Ombi/ClientApp/app/settings/notifications/newsletter.component.html @@ -9,6 +9,16 @@
+ +
+
+ +
+
+
+
+ +