-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: team billing on batch operations #15570
Conversation
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details:
|
@@ -62,7 +63,7 @@ export async function bulkDeleteUsersHandler({ ctx, input }: BulkDeleteUsersHand | |||
// We do this in a transaction to make sure that all memberships are removed before we remove the organization relation from the user | |||
// We also do this to make sure that if one of the queries fail, the whole transaction fails | |||
await prisma.$transaction([removeProfiles, deleteMany, removeOrgrelation]); | |||
|
|||
await updateQuantitySubscriptionFromStripe(currentUser.organizationId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Batch deleting didn't update Stripe subscription before.
@@ -151,7 +151,7 @@ export const inviteMemberHandler = async ({ ctx, input }: InviteMemberOptions) = | |||
isOrg: input.isOrg, | |||
}); | |||
}); | |||
sendEmails(sendVerifEmailsPromises); | |||
await sendEmails(sendVerifEmailsPromises); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was causing a race condition that caused to report a wrong membership count
await updateQuantitySubscriptionFromStripe(input.teamId); | ||
} | ||
} | ||
await handleSubscriptionUpdates(team.parentId || input.teamId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored for denesting
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Ignored Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - indeed quick & dirty but straightforward.
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
What does this PR do?
A quick and dirty fix preceding a full refactor on #15366
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?