From 97abecfdc87cc898d2c8e0e6258219ea025d6c06 Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Mon, 23 Oct 2017 12:56:51 +0530 Subject: [PATCH 1/3] Fixing issue with missing slack and discourse notifications --- circle.yml | 2 +- src/common/constants.js | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/circle.yml b/circle.yml index 8503cee..804509a 100644 --- a/circle.yml +++ b/circle.yml @@ -29,7 +29,7 @@ test: deployment: development: - branch: dev + branch: ['dev', 'feature/fixing-missing-project-type-mappings'] owner: topcoder-platform commands: - docker build -t $DEV_AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$AWS_REPOSITORY:$CIRCLE_SHA1 . diff --git a/src/common/constants.js b/src/common/constants.js index 4933723..5371779 100644 --- a/src/common/constants.js +++ b/src/common/constants.js @@ -10,6 +10,7 @@ const _ = require('lodash'); const config = require('config'); +const defaultColor = '#67c5ef' const projectTypes = { app_dev: { label: 'Full App', @@ -27,6 +28,22 @@ const projectTypes = { label: 'Design', color: '#67c5ef', }, + app: { + label: 'App', + color: '#96d957', + }, + quality_assurance: { + label: 'QA', + color: '#96d957', + }, + chatbot: { + label: 'Chatbot', + color: '#96d957', + }, + website: { + label: 'Website', + color: '#96d957', + }, }; const icons = { @@ -52,7 +69,7 @@ module.exports = { projectInReview: (data) => { const obj = { channel: `${config.get('SLACK_CHANNEL_MANAGERS')}`, - color: projectTypes[data.project.type].color, + color: _.get(projectTypes, data.project.type + '.color', defaultColor), pretext: 'A project is ready to be reviewed.', fallback: 'A project is ready to be reviewed.', title: _.get(data, 'project.name', ''), @@ -81,7 +98,7 @@ module.exports = { projectUnclaimed: (data) => { const obj = { icon_url: icons.slack.CoderBotIcon, - color: projectTypes[data.project.type].color, + color: _.get(projectTypes, data.project.type + '.color', defaultColor), channel: `${config.get('SLACK_CHANNEL_COPILOTS')}`, pretext: 'A project has been reviewed and needs a copilot. Please check it out and claim it.', fallback: 'A project has been reviewed and needs a copilot. Please check it out and claim it.', @@ -103,7 +120,7 @@ module.exports = { projectUnclaimedReposted: (data) => { const obj = { icon_url: icons.slack.CoderErrorIcon, - color: projectTypes[data.project.type].color, + color: _.get(projectTypes, data.project.type + '.color', defaultColor), channel: `${config.get('SLACK_CHANNEL_COPILOTS')}`, pretext: 'We\'re still looking for a copilot for a reviewed project. Please check it out and claim it.', fallback: 'We\'re still looking for a copilot for a reviewed project. Please check it out and claim it.', @@ -125,7 +142,7 @@ module.exports = { projectClaimed: (data) => { const obj = { icon_url: icons.slack.CoderGrinningIcon, - color: projectTypes[data.project.type].color, + color: _.get(projectTypes, data.project.type + '.color', defaultColor), channel: `${config.get('SLACK_CHANNEL_COPILOTS')}`, pretext: `${data.firstName} ${data.lastName} has claimed a project. Welcome to the team!`, fallback: `${data.firstName} ${data.lastName} has claimed a project. Welcome to the team!`, From fd6c0995043f7afd288c4aeb7f072e45da102767 Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Mon, 23 Oct 2017 14:20:11 +0530 Subject: [PATCH 2/3] linting --- src/common/constants.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/constants.js b/src/common/constants.js index 5371779..e9905ae 100644 --- a/src/common/constants.js +++ b/src/common/constants.js @@ -10,7 +10,7 @@ const _ = require('lodash'); const config = require('config'); -const defaultColor = '#67c5ef' +const defaultColor = '#67c5ef'; const projectTypes = { app_dev: { label: 'Full App', @@ -69,7 +69,7 @@ module.exports = { projectInReview: (data) => { const obj = { channel: `${config.get('SLACK_CHANNEL_MANAGERS')}`, - color: _.get(projectTypes, data.project.type + '.color', defaultColor), + color: _.get(projectTypes, `${data.project.type}.color`, defaultColor), pretext: 'A project is ready to be reviewed.', fallback: 'A project is ready to be reviewed.', title: _.get(data, 'project.name', ''), @@ -98,7 +98,7 @@ module.exports = { projectUnclaimed: (data) => { const obj = { icon_url: icons.slack.CoderBotIcon, - color: _.get(projectTypes, data.project.type + '.color', defaultColor), + color: _.get(projectTypes, `${data.project.type}.color`, defaultColor), channel: `${config.get('SLACK_CHANNEL_COPILOTS')}`, pretext: 'A project has been reviewed and needs a copilot. Please check it out and claim it.', fallback: 'A project has been reviewed and needs a copilot. Please check it out and claim it.', @@ -120,7 +120,7 @@ module.exports = { projectUnclaimedReposted: (data) => { const obj = { icon_url: icons.slack.CoderErrorIcon, - color: _.get(projectTypes, data.project.type + '.color', defaultColor), + color: _.get(projectTypes, `${data.project.type}.color`, defaultColor), channel: `${config.get('SLACK_CHANNEL_COPILOTS')}`, pretext: 'We\'re still looking for a copilot for a reviewed project. Please check it out and claim it.', fallback: 'We\'re still looking for a copilot for a reviewed project. Please check it out and claim it.', @@ -142,7 +142,7 @@ module.exports = { projectClaimed: (data) => { const obj = { icon_url: icons.slack.CoderGrinningIcon, - color: _.get(projectTypes, data.project.type + '.color', defaultColor), + color: _.get(projectTypes, `${data.project.type}.color`, defaultColor), channel: `${config.get('SLACK_CHANNEL_COPILOTS')}`, pretext: `${data.firstName} ${data.lastName} has claimed a project. Welcome to the team!`, fallback: `${data.firstName} ${data.lastName} has claimed a project. Welcome to the team!`, From 80cd8b3e57aaa116dc5cbd42942783237e5a3532 Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Mon, 23 Oct 2017 15:16:35 +0530 Subject: [PATCH 3/3] Removed build change to prevent it getting deployed to dev --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 804509a..8503cee 100644 --- a/circle.yml +++ b/circle.yml @@ -29,7 +29,7 @@ test: deployment: development: - branch: ['dev', 'feature/fixing-missing-project-type-mappings'] + branch: dev owner: topcoder-platform commands: - docker build -t $DEV_AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$AWS_REPOSITORY:$CIRCLE_SHA1 .