feat(server): delay subscription after invitation accepted or approved (#11992)
This commit is contained in:
@@ -2,11 +2,12 @@ import { Module } from '@nestjs/common';
|
||||
|
||||
import { PermissionModule } from '../../core/permission';
|
||||
import { QuotaModule } from '../../core/quota';
|
||||
import { WorkspaceModule } from '../../core/workspaces';
|
||||
import { LicenseResolver } from './resolver';
|
||||
import { LicenseService } from './service';
|
||||
|
||||
@Module({
|
||||
imports: [QuotaModule, PermissionModule],
|
||||
imports: [QuotaModule, PermissionModule, WorkspaceModule],
|
||||
providers: [LicenseService, LicenseResolver],
|
||||
})
|
||||
export class LicenseModule {}
|
||||
|
||||
@@ -47,7 +47,10 @@ export class LicenseService {
|
||||
memberLimit: quantity,
|
||||
}
|
||||
);
|
||||
await this.models.workspaceUser.refresh(workspaceId, quantity);
|
||||
this.event.emit('workspace.members.allocateSeats', {
|
||||
workspaceId,
|
||||
quantity,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -188,7 +191,7 @@ export class LicenseService {
|
||||
|
||||
@OnEvent('workspace.members.updated')
|
||||
async updateTeamSeats(payload: Events['workspace.members.updated']) {
|
||||
const { workspaceId, count } = payload;
|
||||
const { workspaceId } = payload;
|
||||
|
||||
const license = await this.db.installedLicense.findUnique({
|
||||
where: {
|
||||
@@ -200,6 +203,7 @@ export class LicenseService {
|
||||
return;
|
||||
}
|
||||
|
||||
const count = await this.models.workspaceUser.chargedCount(workspaceId);
|
||||
await this.fetchAffinePro(`/api/team/licenses/${license.key}/seats`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user