File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1147,6 +1147,25 @@ export const redeemInvite = async (inviteId: string): Promise<{ success: boolean
11471147 }
11481148 } ) ;
11491149
1150+ // Delete the account request if it exists since we've redeemed an invite
1151+ const accountRequest = await tx . accountRequest . findUnique ( {
1152+ where : {
1153+ requestedById_orgId : {
1154+ requestedById : user . id ,
1155+ orgId : invite . orgId ,
1156+ }
1157+ } ,
1158+ } ) ;
1159+
1160+ if ( accountRequest ) {
1161+ logger . info ( `Deleting account request ${ accountRequest . id } for user ${ user . id } since they've redeemed an invite` ) ;
1162+ await tx . accountRequest . delete ( {
1163+ where : {
1164+ id : accountRequest . id ,
1165+ }
1166+ } ) ;
1167+ }
1168+
11501169 if ( IS_BILLING_ENABLED ) {
11511170 const result = await incrementOrgSeatCount ( invite . orgId , tx ) ;
11521171 if ( isServiceError ( result ) ) {
You can’t perform that action at this time.
0 commit comments