From c9c2816698f6d5c297f7129caacb5f9ef7e159b7 Mon Sep 17 00:00:00 2001 From: Quentin Petel Date: Mon, 1 Jul 2024 15:45:44 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20V=C3=A9rification=20des=20types=20de=20?= =?UTF-8?q?courriels=20envoy=C3=A9s=20lors=20de=20l'envoi=20des=20mails=20?= =?UTF-8?q?de=20notification=20et=20de=20mise=20=C3=A0=20jour?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/jobs/sendNotificationEmails.js | 5 ++++- server/src/jobs/sendUpdateEmails.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/server/src/jobs/sendNotificationEmails.js b/server/src/jobs/sendNotificationEmails.js index bc849292..5644cd7a 100644 --- a/server/src/jobs/sendNotificationEmails.js +++ b/server/src/jobs/sendNotificationEmails.js @@ -76,7 +76,10 @@ async function sendNotificationEmails(sendEmail, options = {}) { unsubscribe: false, statut: { $nin: [UserStatut.NON_CONCERNE] }, - "emails.templateName": { $not: { $regex: "^notification_.*$" } }, + $and: [ + { "emails.templateName": { $not: { $regex: "^notification_.*$" } } }, + { "emails.templateName": { $not: { $regex: "^update_.*$" } } }, + ], $or: [ { diff --git a/server/src/jobs/sendUpdateEmails.js b/server/src/jobs/sendUpdateEmails.js index a68e0fab..158430c2 100644 --- a/server/src/jobs/sendUpdateEmails.js +++ b/server/src/jobs/sendUpdateEmails.js @@ -76,7 +76,10 @@ async function sendUpdateEmails(sendEmail, options = {}) { unsubscribe: false, statut: { $nin: [UserStatut.NON_CONCERNE] }, - "emails.templateName": { $not: { $regex: "^update_.*$" } }, + $and: [ + { "emails.templateName": { $regex: "^notification_.*$" } }, + { "emails.templateName": { $not: { $regex: "^update_.*$" } } }, + ], $or: [ {