Update NewsletterTemplate.cs

Add ApplicationUrl
This commit is contained in:
Avi 2023-11-07 17:11:49 -06:00 committed by GitHub
commit 10033496e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
using System; using System;
using System.IO; using System.IO;
using System.Text; using System.Text;
using Ombi.I18n.Resources; using Ombi.I18n.Resources;
@ -27,6 +27,7 @@ namespace Ombi.Notifications.Templates
private const string SubjectKey = "{@SUBJECT}"; private const string SubjectKey = "{@SUBJECT}";
private const string DateKey = "{@DATENOW}"; private const string DateKey = "{@DATENOW}";
private const string AppUrl = "{@APPURL}";
private const string Logo = "{@LOGO}"; private const string Logo = "{@LOGO}";
private const string TableLocation = "{@RECENTLYADDED}"; private const string TableLocation = "{@RECENTLYADDED}";
private const string IntroText = "{@INTRO}"; private const string IntroText = "{@INTRO}";
@ -35,13 +36,14 @@ namespace Ombi.Notifications.Templates
private const string PoweredByText = "{@POWEREDBYTEXT}"; 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)); var sb = new StringBuilder(File.ReadAllText(TemplateLocation));
sb.Replace(SubjectKey, subject); sb.Replace(SubjectKey, subject);
sb.Replace(TableLocation, tableHtml); sb.Replace(TableLocation, tableHtml);
sb.Replace(IntroText, intro); sb.Replace(IntroText, intro);
sb.Replace(DateKey, DateTime.Now.ToString("f")); sb.Replace(DateKey, DateTime.Now.ToString("f"));
sb.Replace(AppUrl, applicationUrl);
sb.Replace(Logo, string.IsNullOrEmpty(logo) ? OmbiLogo : logo); sb.Replace(Logo, string.IsNullOrEmpty(logo) ? OmbiLogo : logo);
sb.Replace(Unsubscribe, string.IsNullOrEmpty(unsubscribeLink) ? string.Empty : unsubscribeLink); sb.Replace(Unsubscribe, string.IsNullOrEmpty(unsubscribeLink) ? string.Empty : unsubscribeLink);
sb.Replace(UnsubscribeText, string.IsNullOrEmpty(unsubscribeLink) ? string.Empty : Texts.Unsubscribe); sb.Replace(UnsubscribeText, string.IsNullOrEmpty(unsubscribeLink) ? string.Empty : Texts.Unsubscribe);