From 192809fa0a4438c5515c9b37e32c21b76f0610e0 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 4 Sep 2023 09:06:48 +0200 Subject: [PATCH] Update mjml. --- .../Notifo.Domain.Integrations.csproj | 2 +- .../Email/Formatting/EmailFormatterLiquid.cs | 10 +--------- .../Channels/Email/Formatting/MjmlRenderer.cs | 12 +----------- backend/src/Notifo.Domain/Notifo.Domain.csproj | 2 +- 4 files changed, 4 insertions(+), 22 deletions(-) diff --git a/backend/src/Notifo.Domain.Integrations/Notifo.Domain.Integrations.csproj b/backend/src/Notifo.Domain.Integrations/Notifo.Domain.Integrations.csproj index 9bdb2f86..262b6dd4 100644 --- a/backend/src/Notifo.Domain.Integrations/Notifo.Domain.Integrations.csproj +++ b/backend/src/Notifo.Domain.Integrations/Notifo.Domain.Integrations.csproj @@ -27,7 +27,7 @@ - + diff --git a/backend/src/Notifo.Domain/Channels/Email/Formatting/EmailFormatterLiquid.cs b/backend/src/Notifo.Domain/Channels/Email/Formatting/EmailFormatterLiquid.cs index 22923d51..6c7fb819 100644 --- a/backend/src/Notifo.Domain/Channels/Email/Formatting/EmailFormatterLiquid.cs +++ b/backend/src/Notifo.Domain/Channels/Email/Formatting/EmailFormatterLiquid.cs @@ -64,14 +64,6 @@ public ValueTask ParseAsync(EmailTemplate input, bool strict, throw new EmailFormattingException(context.Errors); } - if (!string.IsNullOrWhiteSpace(input.BodyHtml)) - { - input = input with - { - BodyHtml = MjmlRenderer.FixXML(input.BodyHtml) - }; - } - return new ValueTask(input); } @@ -149,7 +141,7 @@ private static EmailMessage Format(EmailTemplate template, EmailContext context, context.ValidateTemplate(result, EmailTemplateType.BodyHtml); - var (rendered, errors) = MjmlRenderer.Render(result, strict, true); + var (rendered, errors) = MjmlRenderer.Render(result, strict); foreach (var error in errors.OrEmpty()) { diff --git a/backend/src/Notifo.Domain/Channels/Email/Formatting/MjmlRenderer.cs b/backend/src/Notifo.Domain/Channels/Email/Formatting/MjmlRenderer.cs index 5c691031..74f609f4 100644 --- a/backend/src/Notifo.Domain/Channels/Email/Formatting/MjmlRenderer.cs +++ b/backend/src/Notifo.Domain/Channels/Email/Formatting/MjmlRenderer.cs @@ -27,12 +27,7 @@ internal static class MjmlRenderer private static readonly IMjmlRenderer Renderer = new Mjml.Net.MjmlRenderer(); - public static string FixXML(string mjml) - { - return Renderer.FixXML(mjml, OptionsStrict); - } - - public static (string? Html, List? Errors) Render(string? mjml, bool strict, bool fix) + public static (string? Html, List? Errors) Render(string? mjml, bool strict) { if (string.IsNullOrWhiteSpace(mjml)) { @@ -49,11 +44,6 @@ public static (string? Html, List? Errors) Render(string? mjml, b { var options = strict ? OptionsStrict : OptionsOptimized; - if (fix) - { - mjml = Renderer.FixXML(mjml, options); - } - (rendered, var mjmlErrors) = Renderer.Render(mjml, options); errors = mjmlErrors?.Select(x => new TemplateError(x.Error, x.Line ?? -1, x.Column ?? -1)).ToList(); diff --git a/backend/src/Notifo.Domain/Notifo.Domain.csproj b/backend/src/Notifo.Domain/Notifo.Domain.csproj index a0fdc6ca..fdec69e7 100644 --- a/backend/src/Notifo.Domain/Notifo.Domain.csproj +++ b/backend/src/Notifo.Domain/Notifo.Domain.csproj @@ -30,7 +30,7 @@ - +