-
Notifications
You must be signed in to change notification settings - Fork 5
Slack fixes #66
Slack fixes #66
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ module.exports = { | |
fallback: 'A project is ready to be reviewed.', | ||
title: _.get(data, 'project.name', ''), | ||
title_link: `https://connect.${config.get('AUTH_DOMAIN')}/projects/${data.project.id}/`, | ||
text: _.truncate(_.get(data, 'project.description', ''), {length: 200, separator: /,? +.,/ }), | ||
text: _.truncate(_.get(data, 'project.description', ''), { length: 200, separator: /,? +.,/ }), | ||
ts: (new Date(_.get(data, 'project.updatedAt', null))).getTime() / 1000, | ||
fields: [ | ||
{ | ||
|
@@ -40,24 +40,74 @@ module.exports = { | |
}, | ||
{ | ||
title: 'Owner', | ||
value: `${_.get(data, 'owner.firstName', '')} ${_.get(data, 'owner.lastName', '')}` , | ||
value: `${_.get(data, 'owner.firstName', '')} ${_.get(data, 'owner.lastName', '')}`, | ||
short: false, | ||
}, | ||
{ | ||
title: 'Project Type', | ||
value: data.project.type, | ||
short: false, | ||
}, | ||
], | ||
}; | ||
}, | ||
projectUnclaimed: (data) => { | ||
return { | ||
icon_url: 'https://emoji.slack-edge.com/T03R80JP7/coder-the-bot/85ae574c0c7063ef.png', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please move to constants file, 'CoderBotIcon' |
||
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.', | ||
title: _.get(data, 'project.name', ''), | ||
title_link: `https://connect.${config.get('AUTH_DOMAIN')}/projects/${data.project.id}/`, | ||
text: _.truncate(_.get(data, 'project.description', ''), {length: 200, separator: /,? +.,/ }), | ||
text: _.truncate(_.get(data, 'project.description', ''), { length: 200, separator: /,? +.,/ }), | ||
ts: (new Date(_.get(data, 'project.updatedAt', null))).getTime() / 1000, | ||
fields: [] | ||
fields: [ | ||
{ | ||
title: 'Project Type', | ||
value: data.project.type, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above, thanks! |
||
short: false, | ||
}, | ||
] | ||
} | ||
} | ||
}, | ||
projectUnclaimedReposted: (data) => { | ||
return { | ||
icon_url: 'https://emoji.slack-edge.com/T03R80JP7/coder-error/cd2633216e7fd385.png', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move to constants CoderErrorIcon |
||
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.', | ||
title: _.get(data, 'project.name', ''), | ||
title_link: `https://connect.${config.get('AUTH_DOMAIN')}/projects/${data.project.id}/`, | ||
text: _.truncate(_.get(data, 'project.description', ''), { length: 200, separator: /,? +.,/ }), | ||
ts: (new Date(_.get(data, 'project.updatedAt', null))).getTime() / 1000, | ||
fields: [ | ||
{ | ||
title: 'Project Type', | ||
value: data.project.type, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
short: false, | ||
}, | ||
] | ||
} | ||
}, | ||
projectClaimed: (data) => { | ||
return { | ||
icon_url: 'https://emoji.slack-edge.com/T03R80JP7/coder-grinning/a3b7f3fe9e838377.png', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move to constants - CoderGrinningIcon |
||
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!`, | ||
title: _.get(data, 'project.name', ''), | ||
title_link: `https://connect.${config.get('AUTH_DOMAIN')}/projects/${data.project.id}/`, | ||
text: _.truncate(_.get(data, 'project.description', ''), { length: 200, separator: /,? +.,/ }), | ||
ts: (new Date(_.get(data, 'project.updatedAt', null))).getTime() / 1000, | ||
fields: [ | ||
{ | ||
title: 'Project Type', | ||
value: data.project.type, | ||
short: false, | ||
}, | ||
] | ||
} | ||
}, | ||
}, | ||
discourse: { | ||
project: { | ||
|
@@ -107,6 +157,10 @@ module.exports = { | |
title: 'Your project has a new owner', | ||
content: (data) => `${data.firstName} ${data.lastName} is now responsible for project <a href="${data.projectUrl}" rel="nofollow">${data.projectName}</a>. Good luck ${data.firstName}.`, | ||
}, | ||
ownerAdded: { | ||
title: 'Ownership changed', | ||
content: (data) => `Your project has a new owner ${data.firstName} ${data.lastName} is now responsible for project Project title. Good luck ${data.firstName}!`, | ||
}, | ||
}, | ||
}, | ||
project: { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"id": 1185, | ||
"userId": 40051331, | ||
"role": "customer", | ||
"isPrimary": true, | ||
"createdAt": "2016-11-04T03:57:57.000Z", | ||
"updatedAt": "2016-11-04T03:57:57.000Z", | ||
"createdBy": 40152856, | ||
"updatedBy": 40152856, | ||
"projectId": 1 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please map raw project types to the following -