File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
src/routes/projectMemberInvites Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -113,10 +113,23 @@ module.exports = [
113
113
. then ( ( members ) => {
114
114
req . context = req . context || { } ;
115
115
req . context . currentProjectMembers = members ;
116
+ let userId = updatedInvite . userId ;
117
+ // if the requesting user is updating his/her own invite
118
+ if ( ! userId && req . authUser . email === updatedInvite . email ) {
119
+ userId = req . authUser . userId ;
120
+ }
121
+ // if we are not able to identify the user yet, it must be something wrong and we should not create
122
+ // project member
123
+ if ( ! userId ) {
124
+ const err = new Error (
125
+ `Unable to find userId for the invite. ${ updatedInvite . email } has not joined topcoder yet.` ) ;
126
+ err . status = 400 ;
127
+ return next ( err ) ;
128
+ }
116
129
const member = {
117
130
projectId,
118
131
role : updatedInvite . role ,
119
- userId : _ . get ( updatedInvite , 'userId' , req . authUser . userId ) ,
132
+ userId,
120
133
createdBy : req . authUser . userId ,
121
134
updatedBy : req . authUser . userId ,
122
135
} ;
You can’t perform that action at this time.
0 commit comments