fix: :ambulance: Fix unsend email because of locales
Tim Izzo tim@octree.ch
Fri, 06 Dec 2024 15:17:30 +0100
1 files changed,
6 insertions(+),
2 deletions(-)
M
backend/src/api/email/services/email.ts
→
backend/src/api/email/services/email.ts
@@ -70,9 +70,13 @@ matchingLocale = locales?.["en"];
if (!matchingLocale) return null; } - const notif = matchingLocale.notifications?.[notifType]; - try { + const notif = + matchingLocale.notifications?.[notifType] || + locales?.["en"]?.notifications?.[notifType]; + + if (!notif) throw new Error(`Can't found notification locale`); + const subject = _.template(notif.title)({ ...variables, host: strapi.config.server.url,