File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -286,7 +286,7 @@ export class InvitationService {
286
286
}
287
287
288
288
// If accepted, then map user as cohort admin
289
- if ( invitation . invitationStatus === "Accepted" ) {
289
+ if ( updateInvitationDto . invitationStatus === "Accepted" ) {
290
290
// Get role for roleId
291
291
const role = await this . roleRepository . findOne ( {
292
292
where : { tenantId : invitation . tenantId , code : "cohort_admin" } ,
@@ -297,7 +297,11 @@ export class InvitationService {
297
297
where : { userId, roleId : role . roleId } ,
298
298
} ) ;
299
299
300
- if ( userRoleMap ) {
300
+ const cohortMember = await this . cohortMembersRepository . findOne ( {
301
+ where : { cohortId : invitation . cohortId , userId } ,
302
+ } )
303
+
304
+ if ( userRoleMap && cohortMember ) {
301
305
const error = API_RESPONSES . INVITEE_ALREADY_MAPPED ;
302
306
return APIResponse . error (
303
307
response ,
You can’t perform that action at this time.
0 commit comments