@@ -11,10 +11,22 @@ const _ = require('lodash');
11
11
const config = require ( 'config' ) ;
12
12
13
13
const projectTypes = {
14
- app_dev : 'Full App' ,
15
- generic : 'Work Project' ,
16
- visual_prototype : 'Design & Prototype' ,
17
- visual_design : 'Design' ,
14
+ app_dev : {
15
+ label : 'Full App' ,
16
+ color : '#96d957'
17
+ } ,
18
+ generic : {
19
+ label : 'Work Project' ,
20
+ color : '#b47dd6'
21
+ } ,
22
+ visual_prototype : {
23
+ label : 'Design & Prototype' ,
24
+ color : '#67c5ef'
25
+ } ,
26
+ visual_design : {
27
+ label : 'Design' ,
28
+ color : '#67c5ef'
29
+ }
18
30
} ;
19
31
const icons = {
20
32
slack : {
@@ -39,14 +51,17 @@ module.exports = {
39
51
projectInReview : ( data ) => {
40
52
return {
41
53
channel : `${ config . get ( 'SLACK_CHANNEL_MANAGERS' ) } ` ,
54
+ color : projectTypes [ data . project . type ] . color ,
42
55
pretext : 'A project is ready to be reviewed.' ,
43
56
fallback : 'A project is ready to be reviewed.' ,
44
57
title : _ . get ( data , 'project.name' , '' ) ,
45
58
title_link : `https://connect.${ config . get ( 'AUTH_DOMAIN' ) } /projects/${ data . project . id } /` ,
46
- text : _ . truncate ( _ . get ( data , 'project.description' , '' ) , { length : 200 , separator : / , ? + ., / } ) ,
59
+ text : _ . truncate ( _ . get ( data , 'project.description' , '' ) , {
60
+ length : 200 ,
61
+ separator : / , ? + ., /
62
+ } ) ,
47
63
ts : ( new Date ( _ . get ( data , 'project.updatedAt' , null ) ) ) . getTime ( ) / 1000 ,
48
- fields : [
49
- {
64
+ fields : [ {
50
65
title : 'Ref Code' ,
51
66
value : _ . get ( data , 'project.details.utm.code' , '' ) ,
52
67
short : false ,
@@ -58,7 +73,7 @@ module.exports = {
58
73
} ,
59
74
{
60
75
title : 'Project Type' ,
61
- value : projectTypes [ data . project . type ] ,
76
+ value : projectTypes [ data . project . type ] . label ,
62
77
short : false ,
63
78
} ,
64
79
] ,
@@ -67,58 +82,64 @@ module.exports = {
67
82
projectUnclaimed : ( data ) => {
68
83
return {
69
84
icon_url : icons . slack . CoderBotIcon ,
85
+ color : projectTypes [ data . project . type ] . color ,
70
86
channel : `${ config . get ( 'SLACK_CHANNEL_COPILOTS' ) } ` ,
71
87
pretext : 'A project has been reviewed and needs a copilot. Please check it out and claim it.' ,
72
88
fallback : 'A project has been reviewed and needs a copilot. Please check it out and claim it.' ,
73
89
title : _ . get ( data , 'project.name' , '' ) ,
74
90
title_link : `https://connect.${ config . get ( 'AUTH_DOMAIN' ) } /projects/${ data . project . id } /` ,
75
- text : _ . truncate ( _ . get ( data , 'project.description' , '' ) , { length : 200 , separator : / , ? + ., / } ) ,
91
+ text : _ . truncate ( _ . get ( data , 'project.description' , '' ) , {
92
+ length : 200 ,
93
+ separator : / , ? + ., /
94
+ } ) ,
76
95
ts : ( new Date ( _ . get ( data , 'project.updatedAt' , null ) ) ) . getTime ( ) / 1000 ,
77
- fields : [
78
- {
79
- title : 'Project Type' ,
80
- value : projectTypes [ data . project . type ] ,
81
- short : false ,
82
- } ,
83
- ]
96
+ fields : [ {
97
+ title : 'Project Type' ,
98
+ value : projectTypes [ data . project . type ] . label ,
99
+ short : false ,
100
+ } , ]
84
101
}
85
102
} ,
86
103
projectUnclaimedReposted : ( data ) => {
87
104
return {
88
105
icon_url : icons . slack . CoderErrorIcon ,
106
+ color : projectTypes [ data . project . type ] . color ,
89
107
channel : `${ config . get ( 'SLACK_CHANNEL_COPILOTS' ) } ` ,
90
108
pretext : 'We\'re still looking for a copilot for a reviewed project. Please check it out and claim it.' ,
91
109
fallback : 'We\'re still looking for a copilot for a reviewed project. Please check it out and claim it.' ,
92
110
title : _ . get ( data , 'project.name' , '' ) ,
93
111
title_link : `https://connect.${ config . get ( 'AUTH_DOMAIN' ) } /projects/${ data . project . id } /` ,
94
- text : _ . truncate ( _ . get ( data , 'project.description' , '' ) , { length : 200 , separator : / , ? + ., / } ) ,
112
+ text : _ . truncate ( _ . get ( data , 'project.description' , '' ) , {
113
+ length : 200 ,
114
+ separator : / , ? + ., /
115
+ } ) ,
95
116
ts : ( new Date ( _ . get ( data , 'project.updatedAt' , null ) ) ) . getTime ( ) / 1000 ,
96
- fields : [
97
- {
98
- title : 'Project Type' ,
99
- value : projectTypes [ data . project . type ] ,
100
- short : false ,
101
- } ,
102
- ]
117
+ fields : [ {
118
+ title : 'Project Type' ,
119
+ value : projectTypes [ data . project . type ] . label ,
120
+ short : false ,
121
+ } , ]
103
122
}
104
123
} ,
105
124
projectClaimed : ( data ) => {
106
125
return {
107
126
icon_url : icons . slack . CoderGrinningIcon ,
127
+ color : projectTypes [ data . project . type ] . color ,
108
128
channel : `${ config . get ( 'SLACK_CHANNEL_COPILOTS' ) } ` ,
109
129
pretext : `${ data . firstName } ${ data . lastName } has claimed a project. Welcome to the team!` ,
110
130
fallback : `${ data . firstName } ${ data . lastName } has claimed a project. Welcome to the team!` ,
111
131
title : _ . get ( data , 'project.name' , '' ) ,
112
132
title_link : `https://connect.${ config . get ( 'AUTH_DOMAIN' ) } /projects/${ data . project . id } /` ,
113
- text : _ . truncate ( _ . get ( data , 'project.description' , '' ) , { length : 200 , separator : / , ? + ., / } ) ,
133
+ text : _ . truncate ( _ . get ( data , 'project.description' , '' ) , {
134
+ length : 200 ,
135
+ separator : / , ? + ., /
136
+ } ) ,
114
137
ts : ( new Date ( _ . get ( data , 'project.updatedAt' , null ) ) ) . getTime ( ) / 1000 ,
115
- fields : [
116
- {
117
- title : 'Project Type' ,
118
- value : projectTypes [ data . project . type ] ,
119
- short : false ,
120
- } ,
121
- ]
138
+ fields : [ {
139
+ title : 'Project Type' ,
140
+ value : projectTypes [ data . project . type ] . label ,
141
+ short : false ,
142
+ } , ]
122
143
}
123
144
} ,
124
145
} ,
@@ -177,19 +198,52 @@ module.exports = {
177
198
} ,
178
199
} ,
179
200
project : {
180
- created : { notificationType : 'Project.Created' , subject : 'Created' } ,
181
- submittedForReview : { notificationType : 'Project.SubmittedForReview' , subject : 'Submitted for review' } ,
182
- availableForReview : { notificationType : 'Project.AvailableForReview' , subject : 'Available for review' } ,
183
- reviewed : { notificationType : 'Project.Reviewed' , subject : 'Reviewed' } ,
184
- availableToClaim : { notificationType : 'Project.AvailableToClaim' , subject : 'Reviewed - Available to claim' } ,
201
+ created : {
202
+ notificationType : 'Project.Created' ,
203
+ subject : 'Created'
204
+ } ,
205
+ submittedForReview : {
206
+ notificationType : 'Project.SubmittedForReview' ,
207
+ subject : 'Submitted for review'
208
+ } ,
209
+ availableForReview : {
210
+ notificationType : 'Project.AvailableForReview' ,
211
+ subject : 'Available for review'
212
+ } ,
213
+ reviewed : {
214
+ notificationType : 'Project.Reviewed' ,
215
+ subject : 'Reviewed'
216
+ } ,
217
+ availableToClaim : {
218
+ notificationType : 'Project.AvailableToClaim' ,
219
+ subject : 'Reviewed - Available to claim'
220
+ } ,
185
221
} ,
186
222
teamMember : {
187
- added : { notificationType : 'Project.Member.Added' , subject : 'Member added' } ,
188
- managerJoined : { notificationType : 'Project.Member.ManagerJoined' , subject : 'Manager joined' } ,
189
- copilotJoined : { notificationType : 'Project.Member.CopilotJoined' , subject : 'Copilot joined' } ,
190
- removed : { notificationType : 'Project.Member.Removed' , subject : 'Member removed' } ,
191
- left : { notificationType : 'Project.Member.Left' , subject : 'Member left' } ,
192
- ownerChanged : { notificationType : 'Project.Member.OwnerChanged' , subject : 'Ownership changed' } ,
223
+ added : {
224
+ notificationType : 'Project.Member.Added' ,
225
+ subject : 'Member added'
226
+ } ,
227
+ managerJoined : {
228
+ notificationType : 'Project.Member.ManagerJoined' ,
229
+ subject : 'Manager joined'
230
+ } ,
231
+ copilotJoined : {
232
+ notificationType : 'Project.Member.CopilotJoined' ,
233
+ subject : 'Copilot joined'
234
+ } ,
235
+ removed : {
236
+ notificationType : 'Project.Member.Removed' ,
237
+ subject : 'Member removed'
238
+ } ,
239
+ left : {
240
+ notificationType : 'Project.Member.Left' ,
241
+ subject : 'Member left'
242
+ } ,
243
+ ownerChanged : {
244
+ notificationType : 'Project.Member.OwnerChanged' ,
245
+ subject : 'Ownership changed'
246
+ } ,
193
247
} ,
194
248
} ,
195
249
projectStatuses : {
0 commit comments