mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
Fix: Linkify logo in newsletter (#5036)
* Update NewsletterJob.cs Begin work to turn logo in newsletter into link to app * Update NewsletterTemplate.cs Add ApplicationUrl * Update INewsletterTemplate.cs Add applicationUrl * Update NewsletterTemplate.html Turn app logo into link to app * Update src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs Co-authored-by: Jamie <tidusjar@gmail.com> * Update src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs Co-authored-by: Jamie <tidusjar@gmail.com> --------- Co-authored-by: Jamie <tidusjar@gmail.com>
This commit is contained in:
parent
3f3437598d
commit
87796102c6
4 changed files with 9 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Ombi.I18n.Resources;
|
||||
|
@ -27,6 +27,7 @@ namespace Ombi.Notifications.Templates
|
|||
|
||||
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 @@ namespace Ombi.Notifications.Templates
|
|||
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);
|
||||
|
|
|
@ -428,7 +428,7 @@
|
|||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif; vertical-align: top;">
|
||||
<img src="{@LOGO}" style="border: none; -ms-interpolation-mode: bicubic; max-width: 100%;">
|
||||
<a href="{@APPURL}"><img src="{@LOGO}" style="border: none; -ms-interpolation-mode: bicubic; max-width: 100%;"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
|||
}
|
||||
|
||||
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 ?? string.Empty);
|
||||
|
||||
var bodyBuilder = new BodyBuilder
|
||||
{
|
||||
|
@ -216,7 +216,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
|||
|
||||
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 ?? string.Empty);
|
||||
|
||||
await _email.Send(
|
||||
new NotificationMessage { Message = html, Subject = messageContent.Subject, To = a.Email },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue