From d550f53b722eea6e452e54d87baae0b9df820623 Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Tue, 1 Oct 2024 10:40:18 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Disable=20escaped=20charac?= =?UTF-8?q?ters=20in=20emails=20(#1369)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/emails/src/i18n.ts | 6 +++++- packages/emails/src/templates/finalized-host.tsx | 5 +---- packages/emails/src/templates/finalized-participant.tsx | 4 ---- packages/emails/src/templates/new-comment.tsx | 4 ---- packages/emails/src/templates/new-participant.tsx | 3 --- packages/emails/src/templates/new-poll.tsx | 4 ---- 6 files changed, 6 insertions(+), 20 deletions(-) diff --git a/packages/emails/src/i18n.ts b/packages/emails/src/i18n.ts index 87545c331..9b7512eb6 100644 --- a/packages/emails/src/i18n.ts +++ b/packages/emails/src/i18n.ts @@ -1,3 +1,4 @@ +import type { InitOptions } from "i18next"; import { createInstance } from "i18next"; import resourcesToBackend from "i18next-resources-to-backend"; import { initReactI18next } from "react-i18next/initReactI18next"; @@ -13,12 +14,15 @@ i18nInstance ), ); -const i18nDefaultConfig = { +const i18nDefaultConfig: InitOptions = { lng: "en", fallbackLng: "en", ns: ["emails"], fallbackNS: "emails", defaultNS: "emails", + interpolation: { + escapeValue: false, + }, } as const; export type I18nInstance = typeof i18nInstance; diff --git a/packages/emails/src/templates/finalized-host.tsx b/packages/emails/src/templates/finalized-host.tsx index 8bba8b85e..7fd114b90 100644 --- a/packages/emails/src/templates/finalized-host.tsx +++ b/packages/emails/src/templates/finalized-host.tsx @@ -39,6 +39,7 @@ const FinalizeHostEmail = ({ ns: "emails", defaultValue: "Final date booked! We've notified participants and sent them calendar invites.", + title, })} > @@ -54,7 +55,6 @@ const FinalizeHostEmail = ({ i18nKey="finalizeHost_content" ns="emails" values={{ title }} - shouldUnescape={true} components={{ b: , }} @@ -126,9 +126,6 @@ FinalizeHostEmail.getSubject = ( defaultValue: "Date booked for {{title}}", title: props.title, ns: "emails", - interpolation: { - escapeValue: false, - }, }); }; diff --git a/packages/emails/src/templates/finalized-participant.tsx b/packages/emails/src/templates/finalized-participant.tsx index f2b12d2ca..2dd047197 100644 --- a/packages/emails/src/templates/finalized-participant.tsx +++ b/packages/emails/src/templates/finalized-participant.tsx @@ -53,7 +53,6 @@ const FinalizeParticipantEmail = ({ ns="emails" defaults="{{hostName}} has booked {{title}} for the following date:" values={{ hostName, title }} - shouldUnescape={true} components={{ b: , }} @@ -118,9 +117,6 @@ FinalizeParticipantEmail.getSubject = ( defaultValue: "Date booked for {{title}}", title: props.title, ns: "emails", - interpolation: { - escapeValue: false, - }, }); }; diff --git a/packages/emails/src/templates/new-comment.tsx b/packages/emails/src/templates/new-comment.tsx index fffdfda8b..ac2c878bf 100644 --- a/packages/emails/src/templates/new-comment.tsx +++ b/packages/emails/src/templates/new-comment.tsx @@ -42,7 +42,6 @@ const NewCommentEmail = ({ ns="emails" i18nKey="newComment_content" defaults="{{authorName}} has commented on {{title}}." - shouldUnescape={true} components={{ b: , }} @@ -65,9 +64,6 @@ NewCommentEmail.getSubject = ( defaultValue: "{{authorName}} has commented on {{title}}", authorName: props.authorName, title: props.title, - interpolation: { - escapeValue: false, - }, }); }; diff --git a/packages/emails/src/templates/new-participant.tsx b/packages/emails/src/templates/new-participant.tsx index 270c27117..7a50aa959 100644 --- a/packages/emails/src/templates/new-participant.tsx +++ b/packages/emails/src/templates/new-participant.tsx @@ -69,9 +69,6 @@ NewParticipantEmail.getSubject = ( name: props.participantName, title: props.title, ns: "emails", - interpolation: { - escapeValue: false, - }, }); }; diff --git a/packages/emails/src/templates/new-poll.tsx b/packages/emails/src/templates/new-poll.tsx index a7dad976f..de43f6a6d 100644 --- a/packages/emails/src/templates/new-poll.tsx +++ b/packages/emails/src/templates/new-poll.tsx @@ -46,7 +46,6 @@ export const NewPollEmail = ({ i18nKey="newPoll_content" ns="emails" values={{ title }} - shouldUnescape={true} components={{ b: , }} @@ -72,9 +71,6 @@ NewPollEmail.getSubject = (props: NewPollEmailProps, ctx: EmailContext) => { return ctx.t("newPoll_subject", { defaultValue: "Let's find a date for {{title}}!", title: props.title, - interpolation: { - escapeValue: false, - }, ns: "emails", }); };