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

Fixing issue with slack and coder bot message postings #76

Merged
merged 4 commits into from
Oct 24, 2017
Merged
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
25 changes: 21 additions & 4 deletions src/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
const _ = require('lodash');
const config = require('config');

const defaultColor = '#67c5ef';
const projectTypes = {
app_dev: {
label: 'Full App',
Expand All @@ -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 = {
Expand All @@ -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', ''),
Expand Down Expand Up @@ -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.',
Expand All @@ -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.',
Expand All @@ -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!`,
Expand Down