@@ -202,7 +202,6 @@ module.exports = [
202
202
promises . push ( Promise . resolve ( ) ) ;
203
203
}
204
204
return Promise . all ( promises ) . then ( ( rolesList ) => {
205
- const updatedInvite = invite ;
206
205
if ( ! ! invite . userIds && _ . includes ( PROJECT_MEMBER_MANAGER_ROLES , invite . role ) ) {
207
206
req . log . debug ( 'Chekcing if userId is allowed as manager' ) ;
208
207
const forbidUserList = [ ] ;
@@ -217,16 +216,16 @@ module.exports = [
217
216
if ( forbidUserList . length > 0 ) {
218
217
const message = 'cannot be added with a Manager role to the project' ;
219
218
failed = _ . concat ( failed , _ . map ( forbidUserList , id => _ . assign ( { } , { userId : id , message } ) ) ) ;
220
- updatedInvite . userIds = _ . filter ( invite . userIds , userId => ! _ . includes ( forbidUserList , userId ) ) ;
219
+ invite . userIds = _ . filter ( invite . userIds , userId => ! _ . includes ( forbidUserList , userId ) ) ;
221
220
}
222
221
}
223
222
return models . ProjectMemberInvite . getPendingInvitesForProject ( projectId )
224
223
. then ( ( invites ) => {
225
224
const data = {
226
225
projectId,
227
- role : updatedInvite . role ,
226
+ role : invite . role ,
228
227
// invite directly if user is admin or copilot manager
229
- status : ( updatedInvite . role !== PROJECT_MEMBER_ROLE . COPILOT ||
228
+ status : ( invite . role !== PROJECT_MEMBER_ROLE . COPILOT ||
230
229
util . hasRoles ( req , [ USER_ROLE . CONNECT_ADMIN , USER_ROLE . COPILOT_MANAGER ] ) )
231
230
? INVITE_STATUS . PENDING
232
231
: INVITE_STATUS . REQUESTED ,
@@ -235,7 +234,7 @@ module.exports = [
235
234
} ;
236
235
237
236
req . log . debug ( 'Creating invites' ) ;
238
- return models . sequelize . Promise . all ( buildCreateInvitePromises ( req , updatedInvite , invites , data , failed ) )
237
+ return models . sequelize . Promise . all ( buildCreateInvitePromises ( req , invite , invites , data , failed ) )
239
238
. then ( ( values ) => {
240
239
values . forEach ( ( v ) => {
241
240
req . app . emit ( EVENT . ROUTING_KEY . PROJECT_MEMBER_INVITE_CREATED , {
0 commit comments