diff --git a/src/domain/access/role-set/role.set.resolver.mutations.ts b/src/domain/access/role-set/role.set.resolver.mutations.ts index 6edb0599c..95b588257 100644 --- a/src/domain/access/role-set/role.set.resolver.mutations.ts +++ b/src/domain/access/role-set/role.set.resolver.mutations.ts @@ -923,7 +923,12 @@ export class RoleSetResolverMutations { // Reload to trigger actions invitation = await this.invitationService.getInvitationOrFail( - eventData.invitationID + eventData.invitationID, + { + relations: { + roleSet: true, + }, + } ); let invitationState = await this.invitationService.getLifecycleState( invitation.id @@ -949,20 +954,16 @@ export class RoleSetResolverMutations { } if (agentInfo.userID && invitation.roleSet) { - const isOpenInvitation = - await this.invitationService.isFinalizedInvitation(invitation.id); invitationState = this.lifecycleService.getState( invitation.lifecycle, this.roleSetServiceLifecycleApplication.getApplicationMachine() ); const isMember = invitationState === ApplicationLifecycleState.APPROVED; if (agentInfo.userID && invitation.roleSet) { - if (!isOpenInvitation) { - await this.roleSetCacheService.deleteOpenInvitationFromCache( - agentInfo.userID, - invitation.roleSet.id - ); - } + await this.roleSetCacheService.deleteOpenInvitationFromCache( + agentInfo.userID, + invitation.roleSet.id + ); await this.roleSetCacheService.setAgentIsMemberCache( agentInfo.agentID, invitation.roleSet.id, @@ -971,18 +972,6 @@ export class RoleSetResolverMutations { } } - if (agentInfo.userID && invitation.roleSet) { - await this.roleSetCacheService.deleteOpenApplicationFromCache( - agentInfo.userID, - invitation.roleSet.id - ); - await this.roleSetCacheService.setAgentIsMemberCache( - agentInfo.agentID, - invitation.roleSet.id, - true - ); - } - return await this.invitationService.getInvitationOrFail(invitation.id); }