[nouns] notification emails for admins in db, not in .env

This commit is contained in:
Avris 2020-11-05 17:44:11 +01:00
parent 51390d8bac
commit 05468ff5aa
1 changed files with 5 additions and 3 deletions

View File

@ -18,10 +18,12 @@ async function notify() {
console.log('Entries awaiting moderation: ', awaitingModerationGrouped); console.log('Entries awaiting moderation: ', awaitingModerationGrouped);
for (let admin of process.env.MAILER_ADMINS.split(',')) { const admins = await db.all(`SELECT email FROM users WHERE roles = 'admin'`);
console.log('Sending email to ' + admin)
for (let { email } of admins) {
console.log('Sending email to ' + email)
mailer( mailer(
admin, email,
'[Pronouns] Dictionary entries awaiting moderation: ' + JSON.stringify(awaitingModerationGrouped), '[Pronouns] Dictionary entries awaiting moderation: ' + JSON.stringify(awaitingModerationGrouped),
JSON.stringify(awaitingModerationGrouped) JSON.stringify(awaitingModerationGrouped)
); );