From 9377bbc4e50444692287a0b6e878cbe556c94eff Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Wed, 25 Apr 2018 17:57:48 +0530 Subject: [PATCH 1/3] Email improvements --- .circleci/config.yml | 2 +- config/default.js | 1 + src/app.js | 10 +++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) 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..74b2040 100644 --- a/src/app.js +++ b/src/app.js @@ -91,9 +91,11 @@ function startKafkaConsumer(handlers) { userEmail = config.DEV_MODE_EMAIL; } const recipients = [userEmail]; + const cc = []; if (notificationType === BUS_API_EVENT.EMAIL.MENTIONED_IN_POST) { - recipients.push(config.MENTION_EMAIL); + cc.push(config.MENTION_EMAIL); } + const categories = [`${config.ENV}:${eventType}`]; // 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({ From 7da58716500092cc912edb695ba543bf0b4d2f57 Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Wed, 25 Apr 2018 18:18:43 +0530 Subject: [PATCH 2/3] Fixed condition for adding cc in user mention event --- src/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.js b/src/app.js index 74b2040..49eab89 100644 --- a/src/app.js +++ b/src/app.js @@ -92,7 +92,7 @@ function startKafkaConsumer(handlers) { } const recipients = [userEmail]; const cc = []; - if (notificationType === BUS_API_EVENT.EMAIL.MENTIONED_IN_POST) { + if (eventType === BUS_API_EVENT.EMAIL.MENTIONED_IN_POST) { cc.push(config.MENTION_EMAIL); } const categories = [`${config.ENV}:${eventType}`]; From 08701c75eb85f3ff5636bdc85424154f0649d81d Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Thu, 26 Apr 2018 11:20:21 +0530 Subject: [PATCH 3/3] Lower cased event categories --- src/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.js b/src/app.js index 49eab89..5f98316 100644 --- a/src/app.js +++ b/src/app.js @@ -95,7 +95,7 @@ function startKafkaConsumer(handlers) { if (eventType === BUS_API_EVENT.EMAIL.MENTIONED_IN_POST) { cc.push(config.MENTION_EMAIL); } - const categories = [`${config.ENV}:${eventType}`]; + const categories = [`${config.ENV}:${eventType}`.toLowerCase()]; // get jwt token then encode it with base64 const body = {