From 14daa70fe9f0c2e758f39610845810b9930c7142 Mon Sep 17 00:00:00 2001 From: Avi <357984+Unimatrix0@users.noreply.github.com> Date: Tue, 7 Nov 2023 17:03:38 -0600 Subject: [PATCH 1/6] Update NewsletterJob.cs Begin work to turn logo in newsletter into link to app --- src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs b/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs index 0a082bfe6e..a1182d4f28 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs @@ -174,7 +174,7 @@ public async Task Start(NewsletterSettings settings, bool test) } var url = GenerateUnsubscribeLink(customization.ApplicationUrl, user.Id); - var html = email.LoadTemplate(messageContent.Subject, messageContent.Message, body, customization.Logo, url); + var html = email.LoadTemplate(messageContent.Subject, messageContent.Message, body, customization.Logo, url, customization.ApplicationUrl); var bodyBuilder = new BodyBuilder { @@ -216,7 +216,7 @@ public async Task Start(NewsletterSettings settings, bool test) var email = new NewsletterTemplate(); - var html = email.LoadTemplate(messageContent.Subject, messageContent.Message, body, customization.Logo, unsubscribeLink); + var html = email.LoadTemplate(messageContent.Subject, messageContent.Message, body, customization.Logo, unsubscribeLink, customization.ApplicationUrl); await _email.Send( new NotificationMessage { Message = html, Subject = messageContent.Subject, To = a.Email }, From 10033496e7be19dfc6ecaecb3af365af5415d755 Mon Sep 17 00:00:00 2001 From: Avi <357984+Unimatrix0@users.noreply.github.com> Date: Tue, 7 Nov 2023 17:11:49 -0600 Subject: [PATCH 2/6] Update NewsletterTemplate.cs Add ApplicationUrl --- src/Ombi.Notifications.Templates/NewsletterTemplate.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Ombi.Notifications.Templates/NewsletterTemplate.cs b/src/Ombi.Notifications.Templates/NewsletterTemplate.cs index 9d3b1632af..d83197d240 100644 --- a/src/Ombi.Notifications.Templates/NewsletterTemplate.cs +++ b/src/Ombi.Notifications.Templates/NewsletterTemplate.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Text; using Ombi.I18n.Resources; @@ -27,6 +27,7 @@ public override string TemplateLocation private const string SubjectKey = "{@SUBJECT}"; private const string DateKey = "{@DATENOW}"; + private const string AppUrl = "{@APPURL}"; private const string Logo = "{@LOGO}"; private const string TableLocation = "{@RECENTLYADDED}"; private const string IntroText = "{@INTRO}"; @@ -35,13 +36,14 @@ public override string TemplateLocation private const string PoweredByText = "{@POWEREDBYTEXT}"; - public string LoadTemplate(string subject, string intro, string tableHtml, string logo, string unsubscribeLink) + public string LoadTemplate(string subject, string intro, string tableHtml, string logo, string unsubscribeLink, string applicationUrl) { var sb = new StringBuilder(File.ReadAllText(TemplateLocation)); sb.Replace(SubjectKey, subject); sb.Replace(TableLocation, tableHtml); sb.Replace(IntroText, intro); sb.Replace(DateKey, DateTime.Now.ToString("f")); + sb.Replace(AppUrl, applicationUrl); sb.Replace(Logo, string.IsNullOrEmpty(logo) ? OmbiLogo : logo); sb.Replace(Unsubscribe, string.IsNullOrEmpty(unsubscribeLink) ? string.Empty : unsubscribeLink); sb.Replace(UnsubscribeText, string.IsNullOrEmpty(unsubscribeLink) ? string.Empty : Texts.Unsubscribe); From e2971f821e236234bfbd604f4ffe0608247a1f19 Mon Sep 17 00:00:00 2001 From: Avi <357984+Unimatrix0@users.noreply.github.com> Date: Tue, 7 Nov 2023 17:12:23 -0600 Subject: [PATCH 3/6] Update INewsletterTemplate.cs Add applicationUrl --- src/Ombi.Notifications.Templates/INewsletterTemplate.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ombi.Notifications.Templates/INewsletterTemplate.cs b/src/Ombi.Notifications.Templates/INewsletterTemplate.cs index 620cf39992..11d0e7431d 100644 --- a/src/Ombi.Notifications.Templates/INewsletterTemplate.cs +++ b/src/Ombi.Notifications.Templates/INewsletterTemplate.cs @@ -2,6 +2,6 @@ { public interface INewsletterTemplate { - string LoadTemplate(string subject, string intro, string tableHtml, string logo, string unsubscribeLink); + string LoadTemplate(string subject, string intro, string tableHtml, string logo, string unsubscribeLink, string applicationUrl); } -} \ No newline at end of file +} From b2e92ced5b784573648b3fe4a209e19e9eaa5533 Mon Sep 17 00:00:00 2001 From: Avi <357984+Unimatrix0@users.noreply.github.com> Date: Tue, 7 Nov 2023 17:18:27 -0600 Subject: [PATCH 4/6] Update NewsletterTemplate.html Turn app logo into link to app --- .../Templates/NewsletterTemplate.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ombi.Notifications.Templates/Templates/NewsletterTemplate.html b/src/Ombi.Notifications.Templates/Templates/NewsletterTemplate.html index fdafdb609d..12be6b5c4a 100644 --- a/src/Ombi.Notifications.Templates/Templates/NewsletterTemplate.html +++ b/src/Ombi.Notifications.Templates/Templates/NewsletterTemplate.html @@ -428,7 +428,7 @@ - + From 0de7c2a610e6af57ea026d0fed9eec927a35f7ce Mon Sep 17 00:00:00 2001 From: Avi <357984+Unimatrix0@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:04:37 -0600 Subject: [PATCH 5/6] Update src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs Co-authored-by: Jamie --- src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs b/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs index a1182d4f28..89d801dae6 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs @@ -174,7 +174,7 @@ public async Task Start(NewsletterSettings settings, bool test) } var url = GenerateUnsubscribeLink(customization.ApplicationUrl, user.Id); - var html = email.LoadTemplate(messageContent.Subject, messageContent.Message, body, customization.Logo, url, customization.ApplicationUrl); + var html = email.LoadTemplate(messageContent.Subject, messageContent.Message, body, customization.Logo, url, customization.ApplicationUrl ?? string.Empty); var bodyBuilder = new BodyBuilder { From 437ddc44a3f994859d0b63791364d52a5f48c799 Mon Sep 17 00:00:00 2001 From: Avi <357984+Unimatrix0@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:04:55 -0600 Subject: [PATCH 6/6] Update src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs Co-authored-by: Jamie --- src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs b/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs index 89d801dae6..4107a3bea1 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs @@ -216,7 +216,7 @@ public async Task Start(NewsletterSettings settings, bool test) var email = new NewsletterTemplate(); - var html = email.LoadTemplate(messageContent.Subject, messageContent.Message, body, customization.Logo, unsubscribeLink, customization.ApplicationUrl); + var html = email.LoadTemplate(messageContent.Subject, messageContent.Message, body, customization.Logo, unsubscribeLink, customization.ApplicationUrl ?? string.Empty); await _email.Send( new NotificationMessage { Message = html, Subject = messageContent.Subject, To = a.Email },