Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linkify logo in newsletter #5036

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Ombi.Notifications.Templates/INewsletterTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
6 changes: 4 additions & 2 deletions src/Ombi.Notifications.Templates/NewsletterTemplate.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.Text;
using Ombi.I18n.Resources;
Expand Down Expand Up @@ -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}";
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? string.Empty);

var bodyBuilder = new BodyBuilder
{
Expand Down Expand Up @@ -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 ?? string.Empty);

await _email.Send(
new NotificationMessage { Message = html, Subject = messageContent.Subject, To = a.Email },
Expand Down
Loading