@@ -202,7 +202,6 @@ module.exports = [
202202 promises . push ( Promise . resolve ( ) ) ;
203203 }
204204 return Promise . all ( promises ) . then ( ( rolesList ) => {
205- const updatedInvite = invite ;
206205 if ( ! ! invite . userIds && _ . includes ( PROJECT_MEMBER_MANAGER_ROLES , invite . role ) ) {
207206 req . log . debug ( 'Chekcing if userId is allowed as manager' ) ;
208207 const forbidUserList = [ ] ;
@@ -217,16 +216,16 @@ module.exports = [
217216 if ( forbidUserList . length > 0 ) {
218217 const message = 'cannot be added with a Manager role to the project' ;
219218 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 ) ) ;
221220 }
222221 }
223222 return models . ProjectMemberInvite . getPendingInvitesForProject ( projectId )
224223 . then ( ( invites ) => {
225224 const data = {
226225 projectId,
227- role : updatedInvite . role ,
226+ role : invite . role ,
228227 // 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 ||
230229 util . hasRoles ( req , [ USER_ROLE . CONNECT_ADMIN , USER_ROLE . COPILOT_MANAGER ] ) )
231230 ? INVITE_STATUS . PENDING
232231 : INVITE_STATUS . REQUESTED ,
@@ -235,7 +234,7 @@ module.exports = [
235234 } ;
236235
237236 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 ) )
239238 . then ( ( values ) => {
240239 values . forEach ( ( v ) => {
241240 req . app . emit ( EVENT . ROUTING_KEY . PROJECT_MEMBER_INVITE_CREATED , {
0 commit comments