diff --git a/.circleci/config.yml b/.circleci/config.yml index 9ae216a..ee7fe52 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,7 +82,7 @@ workflows: - "build-dev": filters: branches: - only: [dev, 'feature/discourseMigration'] + only: [dev, 'feature/notification-email-improvements'] - "build-prod": filters: branches: diff --git a/config/default.js b/config/default.js index be3abf0..e6dfdc0 100644 --- a/config/default.js +++ b/config/default.js @@ -2,6 +2,7 @@ * The configuration file. */ module.exports = { + ENV: process.env.ENV, LOG_LEVEL: process.env.LOG_LEVEL, PORT: process.env.PORT, authSecret: process.env.authSecret, diff --git a/src/app.js b/src/app.js index d0f4d91..5f98316 100644 --- a/src/app.js +++ b/src/app.js @@ -91,9 +91,11 @@ function startKafkaConsumer(handlers) { userEmail = config.DEV_MODE_EMAIL; } const recipients = [userEmail]; - if (notificationType === BUS_API_EVENT.EMAIL.MENTIONED_IN_POST) { - recipients.push(config.MENTION_EMAIL); + const cc = []; + if (eventType === BUS_API_EVENT.EMAIL.MENTIONED_IN_POST) { + cc.push(config.MENTION_EMAIL); } + const categories = [`${config.ENV}:${eventType}`.toLowerCase()]; // get jwt token then encode it with base64 const body = { @@ -123,6 +125,12 @@ function startKafkaConsumer(handlers) { }, recipients, replyTo, + cc, + from: { + name: notification.contents.userHandle, + email: 'topcoder@connectemail.topcoder.com',//TODO pick from config + }, + categories, }; // send event to bus api return service.postEvent({