From 078b965733b6b1837d0c88958ff96e7efdef78dd Mon Sep 17 00:00:00 2001
From: joostdecock
- {{ lead1 }}
-
+ {{ lead1 }}
+
-
-`),
- text: wrap.text(`${headingRow.text}
-{{lead1}}
-{{lead2}}
-
-{{greeting}}
-joost
-
-PS: {{ps}}`),
-}
-
-export const translations = {}
diff --git a/sites/backend/src/templates/email/goodbye/goodbye.en.yaml b/sites/backend/src/templates/email/goodbye/goodbye.en.yaml
new file mode 100644
index 00000000000..c1bd9e918fe
--- /dev/null
+++ b/sites/backend/src/templates/email/goodbye/goodbye.en.yaml
@@ -0,0 +1,5 @@
+subject: '[FreeSewing] Farewell'
+heading: FIXME
+lead: fixme
+text-lead: fixme
+closing: fixme
diff --git a/sites/backend/src/templates/email/goodbye/index.mjs b/sites/backend/src/templates/email/goodbye/index.mjs
new file mode 100644
index 00000000000..65734e78df0
--- /dev/null
+++ b/sites/backend/src/templates/email/goodbye/index.mjs
@@ -0,0 +1,38 @@
+import { headingRow, wrap } from '../shared/blocks.mjs'
+// Translations
+import en from '../../../../public/locales/en/goodbye.json' assert { type: 'json' }
+import de from '../../../../public/locales/de/goodbye.json' assert { type: 'json' }
+import es from '../../../../public/locales/es/goodbye.json' assert { type: 'json' }
+import fr from '../../../../public/locales/fr/goodbye.json' assert { type: 'json' }
+import nl from '../../../../public/locales/nl/goodbye.json' assert { type: 'json' }
+
+export const goodbye = {
+ html: wrap.html(`
+ ${headingRow.html}
+
-
-
- {{ lead2 }}
-
- {{ greeting }},
-
- joost
-
- PS: {{ ps }}.
-
+
+`),
+ text: wrap.text(`${headingRow.text}
+{{lead1}}
+{{lead2}}
+
+{{greeting}}
+joost
+
+PS: {{ps}}`),
+}
+
+export const translations = { en, de, es, fr, nl }
diff --git a/sites/backend/src/templates/email/index.mjs b/sites/backend/src/templates/email/index.mjs
index 591a09bfeaf..d504e76c8fc 100644
--- a/sites/backend/src/templates/email/index.mjs
+++ b/sites/backend/src/templates/email/index.mjs
@@ -1,9 +1,17 @@
-import { emailChange, translations as emailChangeTranslations } from './emailchange.mjs'
-import { goodbye, translations as goodbyeTranslations } from './goodbye.mjs'
-import { loginLink, translations as loginLinkTranslations } from './loginlink.mjs'
-import { newsletterSub, translations as newsletterSubTranslations } from './newslettersub.mjs'
-import { passwordReset, translations as passwordResetTranslations } from './passwordreset.mjs'
-import { signup, translations as signupTranslations } from './signup.mjs'
+import { emailChange, translations as emailChangeTranslations } from './emailchange/index.mjs'
+import { goodbye, translations as goodbyeTranslations } from './goodbye/index.mjs'
+import { loginLink, translations as loginLinkTranslations } from './loginlink/index.mjs'
+import { newsletterSub, translations as newsletterSubTranslations } from './newslettersub/index.mjs'
+import { passwordReset, translations as passwordResetTranslations } from './passwordreset/index.mjs'
+import { signup, translations as signupTranslations } from './signup/index.mjs'
+import { signupAea, translations as signupAeaTranslations } from './signup-aea/index.mjs'
+import { signupAed, translations as signupAedTranslations } from './signup-aed/index.mjs'
+// Shared translations
+import en from '../../../public/locales/en/shared.json' assert { type: 'json' }
+import de from '../../../public/locales/de/shared.json' assert { type: 'json' }
+import es from '../../../public/locales/es/shared.json' assert { type: 'json' }
+import fr from '../../../public/locales/fr/shared.json' assert { type: 'json' }
+import nl from '../../../public/locales/nl/shared.json' assert { type: 'json' }
export const templates = {
emailChange,
@@ -12,12 +20,10 @@ export const templates = {
newsletterSub,
passwordReset,
signup,
+ 'signup-aea': signupAea,
+ 'signup-aed': signupAed,
}
-/*
- * This is not part of our i18n package for... reasons
- * It's not an accident, let's put it that way.
- */
export const translations = {
emailChange: emailChangeTranslations,
goodbye: goodbyeTranslations,
@@ -25,4 +31,7 @@ export const translations = {
newsletterSub: newsletterSubTranslations,
passwordReset: passwordResetTranslations,
signup: signupTranslations,
+ 'signup-aea': signupAeaTranslations,
+ 'signup-aed': signupAedTranslations,
+ shared: { en, de, es, fr, nl },
}
diff --git a/sites/backend/src/templates/email/loginlink.mjs b/sites/backend/src/templates/email/loginlink/index.mjs
similarity index 55%
rename from sites/backend/src/templates/email/loginlink.mjs
rename to sites/backend/src/templates/email/loginlink/index.mjs
index 68c224eea20..60617749dae 100644
--- a/sites/backend/src/templates/email/loginlink.mjs
+++ b/sites/backend/src/templates/email/loginlink/index.mjs
@@ -1,18 +1,11 @@
-import { buttonRow, closingRow, headingRow, lead1Row, wrap } from './blocks.mjs'
-import { translations as sharedTranslations } from './blocks.mjs'
+import { buttonRow, closingRow, headingRow, lead1Row, wrap } from '../shared/blocks.mjs'
+// Translations
+import en from '../../../../public/locales/en/loginlink.json' assert { type: 'json' }
+import de from '../../../../public/locales/de/loginlink.json' assert { type: 'json' }
+import es from '../../../../public/locales/es/loginlink.json' assert { type: 'json' }
+import fr from '../../../../public/locales/fr/loginlink.json' assert { type: 'json' }
+import nl from '../../../../public/locales/nl/loginlink.json' assert { type: 'json' }
-/*
- * Used the following replacements:
- * - actionUrl
- * - heading
- * - lead
- * - button
- * - closing
- * - greeting
- * - ps-pre-link
- * - ps-link
- * - ps-post-link
- */
export const loginLink = {
html: wrap.html(`
${headingRow}
@@ -39,4 +32,4 @@ ${closingRow.text}
`),
}
-export const translations = {}
+export const translations = { en, de, es, fr, nl }
diff --git a/sites/backend/src/templates/email/loginlink/loginlink.en.yaml b/sites/backend/src/templates/email/loginlink/loginlink.en.yaml
new file mode 100644
index 00000000000..1eaadb62dae
--- /dev/null
+++ b/sites/backend/src/templates/email/loginlink/loginlink.en.yaml
@@ -0,0 +1,5 @@
+subject: '[FreeSewing] Loginlink fixme'
+heading: FIXME
+lead: fixme
+text-lead: fixme
+closing: fixme
diff --git a/sites/backend/src/templates/email/newslettersub.mjs b/sites/backend/src/templates/email/newslettersub.mjs
deleted file mode 100644
index bc38dde0449..00000000000
--- a/sites/backend/src/templates/email/newslettersub.mjs
+++ /dev/null
@@ -1,31 +0,0 @@
-import { buttonRow, closingRow, headingRow, lead1Row, wrap } from './blocks.mjs'
-import { translations as sharedTranslations } from './blocks.mjs'
-
-/*
- * Used the following replacements:
- * - actionUrl
- * - heading
- * - lead
- * - button
- * - closing
- * - greeting
- * - ps-pre-link
- * - ps-link
- * - ps-post-link
- */
-export const newsletterSub = {
- html: wrap.html(`
- ${headingRow.html}
- ${lead1Row.html}
- ${buttonRow.html}
- ${closingRow.html}
-`),
- text: wrap.text(`
-${headingRow.text}
-${lead1Row.text}
-${buttonRow.text}
-${closingRow.text}
-`),
-}
-
-export const translations = {}
diff --git a/sites/backend/src/templates/email/newslettersub/index.mjs b/sites/backend/src/templates/email/newslettersub/index.mjs
new file mode 100644
index 00000000000..663ac7fe29a
--- /dev/null
+++ b/sites/backend/src/templates/email/newslettersub/index.mjs
@@ -0,0 +1,24 @@
+import { buttonRow, closingRow, headingRow, lead1Row, wrap } from '../shared/blocks.mjs'
+// Translations
+import en from '../../../../public/locales/en/newslettersub.json' assert { type: 'json' }
+import de from '../../../../public/locales/de/newslettersub.json' assert { type: 'json' }
+import es from '../../../../public/locales/es/newslettersub.json' assert { type: 'json' }
+import fr from '../../../../public/locales/fr/newslettersub.json' assert { type: 'json' }
+import nl from '../../../../public/locales/nl/newslettersub.json' assert { type: 'json' }
+
+export const newsletterSub = {
+ html: wrap.html(`
+ ${headingRow.html}
+ ${lead1Row.html}
+ ${buttonRow.html}
+ ${closingRow.html}
+`),
+ text: wrap.text(`
+${headingRow.text}
+${lead1Row.text}
+${buttonRow.text}
+${closingRow.text}
+`),
+}
+
+export const translations = { en, de, es, fr, nl }
diff --git a/sites/backend/src/templates/email/newslettersub/newslettersub.en.yaml b/sites/backend/src/templates/email/newslettersub/newslettersub.en.yaml
new file mode 100644
index 00000000000..67cf759995e
--- /dev/null
+++ b/sites/backend/src/templates/email/newslettersub/newslettersub.en.yaml
@@ -0,0 +1,5 @@
+subject: '[FreeSewing] newsletter sub fixme'
+heading: FIXME
+lead: fixme
+text-lead: fixme
+closing: fixme
diff --git a/sites/backend/src/templates/email/passwordreset.mjs b/sites/backend/src/templates/email/passwordreset/index.mjs
similarity index 60%
rename from sites/backend/src/templates/email/passwordreset.mjs
rename to sites/backend/src/templates/email/passwordreset/index.mjs
index 2722cfc8ebc..458b1d8ec9d 100644
--- a/sites/backend/src/templates/email/passwordreset.mjs
+++ b/sites/backend/src/templates/email/passwordreset/index.mjs
@@ -1,18 +1,11 @@
-import { buttonRow, closingRow, headingRow, lead1Row, wrap } from './blocks.mjs'
-import { translations as sharedTranslations } from './blocks.mjs'
+import { buttonRow, closingRow, headingRow, lead1Row, wrap } from '../shared/blocks.mjs'
+// Translations
+import en from '../../../../public/locales/en/passwordreset.json' assert { type: 'json' }
+import de from '../../../../public/locales/de/passwordreset.json' assert { type: 'json' }
+import es from '../../../../public/locales/es/passwordreset.json' assert { type: 'json' }
+import fr from '../../../../public/locales/fr/passwordreset.json' assert { type: 'json' }
+import nl from '../../../../public/locales/nl/passwordreset.json' assert { type: 'json' }
-/*
- * Used the following replacements:
- * - actionUrl
- * - heading
- * - lead
- * - button
- * - closing
- * - greeting
- * - ps-pre-link
- * - ps-link
- * - ps-post-link
- */
export const passwordReset = {
html: wrap.html(`
${headingRow.html}
@@ -41,4 +34,4 @@ ${closingRow.text}
`),
}
-export const translations = {}
+export const translations = { en, de, es, fr, nl }
diff --git a/sites/backend/src/templates/email/passwordreset/passwordreset.en.yaml b/sites/backend/src/templates/email/passwordreset/passwordreset.en.yaml
new file mode 100644
index 00000000000..f4ad0c51f2d
--- /dev/null
+++ b/sites/backend/src/templates/email/passwordreset/passwordreset.en.yaml
@@ -0,0 +1,5 @@
+subject: '[FreeSewing] passwordreset fixme'
+heading: FIXME
+lead: fixme
+text-lead: fixme
+closing: fixme
diff --git a/sites/backend/src/templates/email/blocks.mjs b/sites/backend/src/templates/email/shared/blocks.mjs
similarity index 81%
rename from sites/backend/src/templates/email/blocks.mjs
rename to sites/backend/src/templates/email/shared/blocks.mjs
index 54a49df4341..d8de4ea55aa 100644
--- a/sites/backend/src/templates/email/blocks.mjs
+++ b/sites/backend/src/templates/email/shared/blocks.mjs
@@ -25,12 +25,10 @@ export const closingRow = {
+
+
+ {{ lead2 }}
+
+ {{ greeting }},
+
+ joost
+
+ PS: {{ ps }}.
+
joost
-
- PS: {{ ps-pre-link}}
-
- {{ ps-link}}
- {{ ps-post-link }}
-
+ PS: {{ ps-pre-link}}
+
+ {{ ps-link}}
+ {{ ps-post-link }}
+ {{ preLead }}
+
+
+ {{ lead }}
+
+
- - {{ website }} + + {{ website }} | - Github + Github | - Discord - | - Twitter - | - {{ whyDidIGetThis }} + Discord + +
+ {{ notMarketing }}
+ |
@@ -223,8 +243,8 @@ ${body}
--
FreeSewing
-Plantin en Moretuslei 69
-Antwerp
+Plantin en Moretuslei 67
+Antwerp 2018
Belgium
{{ website }} : {{{ urlWebsite }}}
@@ -234,26 +254,3 @@ Twitter : https://twitter.com/freesewing_org
{{ whyDidIGetThis }} : {{{ whyUrl }}}
`,
}
-
-export const translations = {
- en: {
- whyDidIGetThis: 'Why did I get this email?',
- website: 'freesewing.org',
- },
- de: {
- whyDidIGetThis: 'Why did I get this?', // FIXME: Provide German translation
- website: 'freesewing.org/de',
- },
- es: {
- whyDidIGetThis: 'Why did I get this?', // FIXME: Provide Spanish translation
- website: 'freesewing.org/es',
- },
- fr: {
- whyDidIGetThis: 'Why did I get this?', // FIXME: Provide French translation
- website: 'freesewing.org/fr',
- },
- nl: {
- whyDidIGetThis: 'Waarom kreeg ik deze email?',
- website: 'freesewing.org/nl',
- },
-}
diff --git a/sites/backend/src/templates/email/shared/shared.en.yaml b/sites/backend/src/templates/email/shared/shared.en.yaml
new file mode 100644
index 00000000000..e20a59187dd
--- /dev/null
+++ b/sites/backend/src/templates/email/shared/shared.en.yaml
@@ -0,0 +1,9 @@
+# Shared
+greeting: love
+ps-pre-link: FreeSewing is free (duh), but please
+ps-link: become a patron
+ps-post-link: if you can afford it.
+text-ps: 'FreeSewing is free (duh), but please become a patron if you can afford it.'
+notMarketing: This is not marketing, but a transactional email about your FreeSewing account.
+seeWhy: 'For more info, see:'
+whyDidIGetThis: Why did I get this email?
diff --git a/sites/backend/src/templates/email/signup-aea/index.mjs b/sites/backend/src/templates/email/signup-aea/index.mjs
new file mode 100644
index 00000000000..bce323c2933
--- /dev/null
+++ b/sites/backend/src/templates/email/signup-aea/index.mjs
@@ -0,0 +1,35 @@
+import { buttonRow, closingRow, headingRow, preLeadRow, wrap } from '../shared/blocks.mjs'
+// Translations
+import en from '../../../../public/locales/en/signup-aea.json' assert { type: 'json' }
+import de from '../../../../public/locales/de/signup-aea.json' assert { type: 'json' }
+import es from '../../../../public/locales/es/signup-aea.json' assert { type: 'json' }
+import fr from '../../../../public/locales/fr/signup-aea.json' assert { type: 'json' }
+import nl from '../../../../public/locales/nl/signup-aea.json' assert { type: 'json' }
+
+// aea = Account Exists and is Active
+export const signupAea = {
+ html: wrap.html(`
+ ${headingRow.html}
+ ${preLeadRow.html}
+ ${buttonRow.html}
+ ${closingRow.html}
+`),
+ text: wrap.text(`
+{{{ heading }}}
+
+{{{ preLead }}}
+
+{{{ textLead }}}
+
+{{{ actionUrl }}}
+
+{{{ closing }}}
+
+{{{ greeting }}},
+joost
+
+PS: {{{ text-ps }}} : {{{ supportUrl }}}
+`),
+}
+
+export const translations = { en, de, es, fr, nl }
diff --git a/sites/backend/src/templates/email/signup-aea/signup-aea.en.yaml b/sites/backend/src/templates/email/signup-aea/signup-aea.en.yaml
new file mode 100644
index 00000000000..edff52d6da4
--- /dev/null
+++ b/sites/backend/src/templates/email/signup-aea/signup-aea.en.yaml
@@ -0,0 +1,7 @@
+subject: "[FreeSewing] No need to sign up, you're already in"
+heading: Welcome back to FreeSewing
+preLead: 'Someone (you?) tried to sign up with this email address. But we already have an active account tied to this email.'
+lead: 'To log in to your account, click the big black button below:'
+text-lead: 'To log in to your account, click the link below:'
+button: Log in
+closing: "That's all it takes."
diff --git a/sites/backend/src/templates/email/signup-aed/index.mjs b/sites/backend/src/templates/email/signup-aed/index.mjs
new file mode 100644
index 00000000000..95f126f2817
--- /dev/null
+++ b/sites/backend/src/templates/email/signup-aed/index.mjs
@@ -0,0 +1,23 @@
+import { closingRow, headingRow, preLeadRow, wrap } from '../shared/blocks.mjs'
+// Translations
+import en from '../../../../public/locales/en/signup-aed.json' assert { type: 'json' }
+import de from '../../../../public/locales/de/signup-aed.json' assert { type: 'json' }
+import es from '../../../../public/locales/es/signup-aed.json' assert { type: 'json' }
+import fr from '../../../../public/locales/fr/signup-aed.json' assert { type: 'json' }
+import nl from '../../../../public/locales/nl/signup-aed.json' assert { type: 'json' }
+
+// aed = Account Exists but is Disabled
+export const signupAed = {
+ html: wrap.html(`
+ ${headingRow.html}
+ ${preLeadRow.html}
+ ${closingRow.html}
+`),
+ text: wrap.text(`${headingRow.text}
+{{ prelead }}
+{{lead }}
+${closingRow.text}
+`),
+}
+
+export const translations = { en, de, es, fr, nl }
diff --git a/sites/backend/src/templates/email/signup-aed/signup-aed.en.yaml b/sites/backend/src/templates/email/signup-aed/signup-aed.en.yaml
new file mode 100644
index 00000000000..1348808394a
--- /dev/null
+++ b/sites/backend/src/templates/email/signup-aed/signup-aed.en.yaml
@@ -0,0 +1,5 @@
+subject: '[FreeSewing] Your account is marked as disabled'
+heading: Your FreeSewing account is disabled
+preLead: 'An account can become disabled when a user revokes consent, or (exceptionally) when an administrator disables it.'
+lead: 'In any case, the only way to re-enable a disabled account is to reach out to support.'
+closing: 'To contact support, you can reply to this email.'
diff --git a/sites/backend/src/templates/email/signup.mjs b/sites/backend/src/templates/email/signup.mjs
deleted file mode 100644
index d6926680e35..00000000000
--- a/sites/backend/src/templates/email/signup.mjs
+++ /dev/null
@@ -1,114 +0,0 @@
-import { buttonRow, closingRow, headingRow, lead1Row, wrap } from './blocks.mjs'
-import { translations as sharedTranslations } from './blocks.mjs'
-
-/*
- * Used the following replacements:
- * - actionUrl
- * - heading
- * - lead
- * - button
- * - closing
- * - greeting
- * - ps-pre-link
- * - ps-link
- * - ps-post-link
- */
-export const signup = {
- html: wrap.html(`
- ${headingRow.html}
- ${lead1Row.html}
- ${buttonRow.html}
- ${closingRow.html}
-`),
- text: wrap.text(`
-{{{ heading }}}
-
-{{{ textLead }}}
-
-{{{ actionUrl }}}
-
-{{{ closing }}}
-
-{{{ greeting }}},
-joost
-
-PS: {{{ text-ps }}} : {{{ supportUrl }}}
-`),
-}
-
-export const translations = {
- en: {
- subject: '[FreeSewing] Confirm your E-mail address to activate your account',
- heading: 'Welcome to FreeSewing',
- lead: 'To activate your account, click the big black rectangle below:',
- textLead: 'To activate your account, click the link below:',
- button: 'Activate account',
- closing: "That's all for now.",
- greeting: 'love',
- 'ps-pre-link': 'FreeSewing is free (duh), but please',
- 'ps-link': 'become a patron',
- 'ps-post-link': 'if you cxan afford it.',
- 'text-ps': 'FreeSewing is free (duh), but please become a patron if you can afford it',
- ...sharedTranslations.en,
- },
- // FIXME: Translate German
- de: {
- subject: '[FreeSewing] Confirm your E-mail address to activate your account',
- heading: 'Welcome to FreeSewing',
- lead: 'To activate your account, click the big black rectangle below:',
- textLead: 'To activate your account, click the link below:',
- button: 'Activate account',
- closing: "That's all for now.",
- greeting: 'love',
- 'ps-pre-link': 'FreeSewing is free (duh), but please',
- 'ps-link': 'become a patron',
- 'ps-post-link': 'if you can afford it.',
- 'text-ps': 'FreeSewing is free (duh), but please become a patron if you can afford it',
- ...sharedTranslations.de,
- },
- // FIXME: Translate Spanish
- es: {
- subject: '[FreeSewing] Confirm your E-mail address to activate your account',
- heading: 'Welcome to FreeSewing',
- lead: 'To activate your account, click the big black rectangle below:',
- textLead: 'To activate your account, click the link below:',
- button: 'Activate account',
- closing: "That's all for now.",
- greeting: 'love',
- 'ps-pre-link': 'FreeSewing is free (duh), but please',
- 'ps-link': 'become a patron',
- 'ps-post-link': 'if you can afford it.',
- 'text-ps': 'FreeSewing is free (duh), but please become a patron if you can afford it',
- ...sharedTranslations.es,
- },
- // FIXME: Translate French
- fr: {
- subject: '[FreeSewing] Confirm your E-mail address to activate your account',
- heading: 'Welcome to FreeSewing',
- lead: 'To activate your account, click the big black rectangle below:',
- textLead: 'To activate your account, click the link below:',
- button: 'Activate account',
- closing: "That's all for now.",
- greeting: 'love',
- 'ps-pre-link': 'FreeSewing is free (duh), but please',
- 'ps-link': 'become a patron',
- 'ps-post-link': 'if you can afford it.',
- 'text-ps': 'FreeSewing is free (duh), but please become a patron if you can afford it',
- ...sharedTranslations.fr,
- },
- nl: {
- subject: '[FreeSewing] Bevestig je E-mail adres om je account te activeren',
- heading: 'Welkom bij FreeSewing',
- lead: 'Om je account te activeren moet je op de grote zwarte rechthoek hieronder te klikken:',
- textLead: 'Om je account te activeren moet je op de link hieronder te klikken:',
- button: 'Account activeren',
- closing: 'Daarmee is dat ook weer geregeld.',
- greeting: 'liefs',
- 'ps-pre-link': 'FreeSewing is gratis (echt), maar gelieve',
- 'ps-link': 'ons werk te ondersteunen',
- 'ps-post-link': 'als het even kan.',
- 'text-ps':
- 'FreeSewing is gratis (echt), maar gelieve ons werk te ondersteunen als het even kan',
- ...sharedTranslations.nl,
- },
-}
diff --git a/sites/backend/src/templates/email/signup/index.mjs b/sites/backend/src/templates/email/signup/index.mjs
new file mode 100644
index 00000000000..43a7a2801c4
--- /dev/null
+++ b/sites/backend/src/templates/email/signup/index.mjs
@@ -0,0 +1,32 @@
+import { buttonRow, closingRow, headingRow, lead1Row, wrap } from '../shared/blocks.mjs'
+// Translations
+import en from '../../../../public/locales/en/signup.json' assert { type: 'json' }
+import de from '../../../../public/locales/de/signup.json' assert { type: 'json' }
+import es from '../../../../public/locales/es/signup.json' assert { type: 'json' }
+import fr from '../../../../public/locales/fr/signup.json' assert { type: 'json' }
+import nl from '../../../../public/locales/nl/signup.json' assert { type: 'json' }
+
+export const signup = {
+ html: wrap.html(`
+ ${headingRow.html}
+ ${lead1Row.html}
+ ${buttonRow.html}
+ ${closingRow.html}
+`),
+ text: wrap.text(`
+{{{ heading }}}
+
+{{{ textLead }}}
+
+{{{ actionUrl }}}
+
+{{{ closing }}}
+
+{{{ greeting }}},
+joost
+
+PS: {{{ text-ps }}} : {{{ supportUrl }}}
+`),
+}
+
+export const translations = { en, de, es, fr, nl }
diff --git a/sites/backend/src/templates/email/signup/signup.en.yaml b/sites/backend/src/templates/email/signup/signup.en.yaml
new file mode 100644
index 00000000000..f821ca52d91
--- /dev/null
+++ b/sites/backend/src/templates/email/signup/signup.en.yaml
@@ -0,0 +1,6 @@
+subject: "[FreeSewing] Here's that signup link we promised you"
+heading: Join FreeSewing
+lead: 'To create a FreeSewing account linked to this email address, click the big black rectangle below:'
+text-lead: 'To create a FreeSewing account linked to this email address, click the link below:'
+button: Create an account
+closing: "That's all for now."
diff --git a/sites/backend/src/utils/email.mjs b/sites/backend/src/utils/email.mjs
index f54d4adf136..cde3071480a 100644
--- a/sites/backend/src/utils/email.mjs
+++ b/sites/backend/src/utils/email.mjs
@@ -1,6 +1,7 @@
import { templates, translations } from '../templates/email/index.mjs'
import { SESv2Client, SendEmailCommand } from '@aws-sdk/client-sesv2'
import mustache from 'mustache'
+import { log } from './log.mjs'
/*
* Exporting this closure that makes sure we have access to the
@@ -20,14 +21,22 @@ export const mailer = (config) => ({
*/
async function sendEmailViaAwsSes(config, { template, to, language = 'en', replacements = {} }) {
// Make sure we have what it takes
- if (!template || !to || typeof templates[template] === 'undefined') return false
+ if (!template || !to || typeof templates[template] === 'undefined') {
+ log.warn(`Tried to email invalid template: ${template}`)
+ return false
+ }
+
+ log.info(`Emailing template ${template} to ${to}`)
// Load template
const { html, text } = templates[template]
const replace = {
+ website: `FreeSewing.org`,
+ ...translations.shared[language],
...translations[template][language],
...replacements,
}
+ if (language !== 'en') replace.website += `${language}/`
// IMHO the AWS apis are a complete clusterfuck
const client = new SESv2Client({ region: config.aws.ses.region })
diff --git a/sites/backend/src/utils/index.mjs b/sites/backend/src/utils/index.mjs
index 7c8d7abacc1..2a0f7ac1f63 100644
--- a/sites/backend/src/utils/index.mjs
+++ b/sites/backend/src/utils/index.mjs
@@ -25,3 +25,8 @@ export const i18nUrl = (lang, path) => {
return url + path
}
+
+/*
+ * Capitalizes a string
+ */
+export const capitalize = (string) => string.charAt(0).toUpperCase() + string.slice(1)
diff --git a/sites/backend/tests/user.mjs b/sites/backend/tests/user.mjs
index b4acc5003e8..095e1a179ae 100644
--- a/sites/backend/tests/user.mjs
+++ b/sites/backend/tests/user.mjs
@@ -42,17 +42,17 @@ export const userTests = async (chai, config, expect, store) => {
})
})
- step(`${store.icon('user')} Should fail to signup an existing email address`, (done) => {
+ step(`${store.icon('user')} Should pretend to signup an existing email address`, (done) => {
chai
.request(config.api)
.post('/signup')
.send(fields)
.end((err, res) => {
- expect(res.status).to.equal(400)
+ expect(res.status).to.equal(201)
expect(res.type).to.equal('application/json')
expect(res.charset).to.equal('utf-8')
- expect(res.body.result).to.equal(`error`)
- expect(res.body.error).to.equal('emailExists')
+ expect(res.body.result).to.equal(`success`)
+ expect(res.body.email).to.equal(fields.email)
done()
})
})