mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 20:46:38 +08:00
feat(server): delay subscription after invitation accepted or approved (#11992)
This commit is contained in:
@@ -274,18 +274,21 @@ export class WorkspaceSubscriptionManager extends SubscriptionManager {
|
||||
}
|
||||
|
||||
@OnEvent('workspace.members.updated')
|
||||
async onMembersUpdated({
|
||||
workspaceId,
|
||||
count,
|
||||
}: Events['workspace.members.updated']) {
|
||||
async onMembersUpdated({ workspaceId }: Events['workspace.members.updated']) {
|
||||
const count = await this.models.workspaceUser.chargedCount(workspaceId);
|
||||
const subscription = await this.getSubscription({
|
||||
plan: SubscriptionPlan.Team,
|
||||
workspaceId,
|
||||
});
|
||||
|
||||
if (!subscription || !subscription.stripeSubscriptionId) {
|
||||
if (
|
||||
!subscription ||
|
||||
!subscription.stripeSubscriptionId ||
|
||||
count === subscription.quantity
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const stripeSubscription = await this.stripe.subscriptions.retrieve(
|
||||
subscription.stripeSubscriptionId
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user