Skip to content

Feature/notification email improvements #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ workflows:
- "build-dev":
filters:
branches:
only: [dev, 'feature/discourseMigration']
only: [dev, 'feature/notification-email-improvements']
- "build-prod":
filters:
branches:
Expand Down
1 change: 1 addition & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 10 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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({
Expand Down