Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 6d3985c

Browse files
author
vikasrohit
authored
Merge pull request #76 from topcoder-platform/dev
Fixing issue with slack and coder bot message postings
2 parents 782c2ed + 277fca1 commit 6d3985c

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/common/constants.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
const _ = require('lodash');
1111
const config = require('config');
1212

13+
const defaultColor = '#67c5ef';
1314
const projectTypes = {
1415
app_dev: {
1516
label: 'Full App',
@@ -27,6 +28,22 @@ const projectTypes = {
2728
label: 'Design',
2829
color: '#67c5ef',
2930
},
31+
app: {
32+
label: 'App',
33+
color: '#96d957',
34+
},
35+
quality_assurance: {
36+
label: 'QA',
37+
color: '#96d957',
38+
},
39+
chatbot: {
40+
label: 'Chatbot',
41+
color: '#96d957',
42+
},
43+
website: {
44+
label: 'Website',
45+
color: '#96d957',
46+
},
3047
};
3148

3249
const icons = {
@@ -52,7 +69,7 @@ module.exports = {
5269
projectInReview: (data) => {
5370
const obj = {
5471
channel: `${config.get('SLACK_CHANNEL_MANAGERS')}`,
55-
color: projectTypes[data.project.type].color,
72+
color: _.get(projectTypes, `${data.project.type}.color`, defaultColor),
5673
pretext: 'A project is ready to be reviewed.',
5774
fallback: 'A project is ready to be reviewed.',
5875
title: _.get(data, 'project.name', ''),
@@ -81,7 +98,7 @@ module.exports = {
8198
projectUnclaimed: (data) => {
8299
const obj = {
83100
icon_url: icons.slack.CoderBotIcon,
84-
color: projectTypes[data.project.type].color,
101+
color: _.get(projectTypes, `${data.project.type}.color`, defaultColor),
85102
channel: `${config.get('SLACK_CHANNEL_COPILOTS')}`,
86103
pretext: 'A project has been reviewed and needs a copilot. Please check it out and claim it.',
87104
fallback: 'A project has been reviewed and needs a copilot. Please check it out and claim it.',
@@ -103,7 +120,7 @@ module.exports = {
103120
projectUnclaimedReposted: (data) => {
104121
const obj = {
105122
icon_url: icons.slack.CoderErrorIcon,
106-
color: projectTypes[data.project.type].color,
123+
color: _.get(projectTypes, `${data.project.type}.color`, defaultColor),
107124
channel: `${config.get('SLACK_CHANNEL_COPILOTS')}`,
108125
pretext: 'We\'re still looking for a copilot for a reviewed project. Please check it out and claim it.',
109126
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 = {
125142
projectClaimed: (data) => {
126143
const obj = {
127144
icon_url: icons.slack.CoderGrinningIcon,
128-
color: projectTypes[data.project.type].color,
145+
color: _.get(projectTypes, `${data.project.type}.color`, defaultColor),
129146
channel: `${config.get('SLACK_CHANNEL_COPILOTS')}`,
130147
pretext: `${data.firstName} ${data.lastName} has claimed a project. Welcome to the team!`,
131148
fallback: `${data.firstName} ${data.lastName} has claimed a project. Welcome to the team!`,

0 commit comments

Comments
 (0)