check if user is subscribed before sending email

This commit is contained in:
Bilal Catic
2019-11-05 07:54:23 +01:00
parent 8ea44f5fc7
commit 310448dcb8

View File

@@ -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(