From 310448dcb8840abd0067bedae25a17ed6e658a05 Mon Sep 17 00:00:00 2001 From: Bilal Catic Date: Tue, 5 Nov 2019 07:54:23 +0100 Subject: [PATCH] check if user is subscribed before sending email --- app/services/notificationService.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/notificationService.js b/app/services/notificationService.js index 194d3f6..7495e17 100644 --- a/app/services/notificationService.js +++ b/app/services/notificationService.js @@ -36,8 +36,8 @@ const notifyMatches = async (matches, dailyNotification = false) => { const asyncSendEmailActions = []; for (const id of searchRequestsToNotify) { const { searchRequest, notifyNow } = matches[id]; - if (notifyNow) { - const { email } = searchRequest; + const { email, subscribed } = searchRequest; + if (notifyNow && subscribed) { const allMatchingRealEstates = matches[id].realEstates || []; if (allMatchingRealEstates.length > 0) { const emailContent = generateNotificationEmail( -- 2.47.3