fix: do not send email if 0 notifications

This commit is contained in:
Cédric Moreau
2022-05-29 13:20:23 +02:00
parent 4b057882bd
commit 2ac42c4ec0

View File

@@ -59,8 +59,10 @@ async function consumeQueue() {
body += `<h3>${message.subject}</h3>\n` body += `<h3>${message.subject}</h3>\n`
body += `<div>${message.body}</div>\n` body += `<div>${message.body}</div>\n`
} }
if (messages.length) {
await sendEmail(subject, body, cc || undefined) await sendEmail(subject, body, cc || undefined)
} }
}
} else { } else {
const mail = queue.shift() as MailContent const mail = queue.shift() as MailContent
await sendEmail(mail.subject, mail.body, mail.cc) await sendEmail(mail.subject, mail.body, mail.cc)