Refactor onboarding user vars to be absent when user is fully onboarded (#6531)
In this PR: - take feedbacks from: https://github.com/twentyhq/twenty/pull/6530 / https://github.com/twentyhq/twenty/pull/6529 / https://github.com/twentyhq/twenty/pull/6526 / https://github.com/twentyhq/twenty/pull/6512 - refactor onboarding uservars to be absent when the user is fully onboarded: isStepComplete ==> isStepIncomplete - introduce a new workspace.activationStatus: CREATION_ONGOING I'm retesting the whole flow: - with/without BILLING - sign in with/without SSO - sign up with/without SSO - another workspaceMembers join the team - subscriptionCanceled - access to billingPortal
This commit is contained in:
@ -93,10 +93,10 @@ export class GoogleAPIsAuthController {
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
await onboardingServiceInstance.toggleOnboardingConnectAccountCompletion({
|
||||
await onboardingServiceInstance.setOnboardingConnectAccountPending({
|
||||
userId,
|
||||
workspaceId,
|
||||
value: true,
|
||||
value: false,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
import { HttpService } from '@nestjs/axios';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import { HttpService } from '@nestjs/axios';
|
||||
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { User } from 'src/engine/core-modules/user/user.entity';
|
||||
import { EnvironmentService } from 'src/engine/integrations/environment/environment.service';
|
||||
import { SignInUpService } from 'src/engine/core-modules/auth/services/sign-in-up.service';
|
||||
import { FileUploadService } from 'src/engine/core-modules/file/file-upload/services/file-upload.service';
|
||||
import { UserWorkspaceService } from 'src/engine/core-modules/user-workspace/user-workspace.service';
|
||||
import { WorkspaceService } from 'src/engine/core-modules/workspace/services/workspace.service';
|
||||
import { OnboardingService } from 'src/engine/core-modules/onboarding/onboarding.service';
|
||||
import { UserWorkspaceService } from 'src/engine/core-modules/user-workspace/user-workspace.service';
|
||||
import { User } from 'src/engine/core-modules/user/user.entity';
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { EnvironmentService } from 'src/engine/integrations/environment/environment.service';
|
||||
|
||||
describe('SignInUpService', () => {
|
||||
let service: SignInUpService;
|
||||
|
||||
@ -175,6 +175,18 @@ export class SignInUpService {
|
||||
await this.userWorkspaceService.create(user.id, workspace.id);
|
||||
await this.userWorkspaceService.createWorkspaceMember(workspace.id, user);
|
||||
|
||||
await this.onboardingService.setOnboardingConnectAccountPending({
|
||||
userId: user.id,
|
||||
workspaceId: workspace.id,
|
||||
value: true,
|
||||
});
|
||||
|
||||
await this.onboardingService.setOnboardingCreateProfileCompletion({
|
||||
userId: user.id,
|
||||
workspaceId: workspace.id,
|
||||
value: true,
|
||||
});
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
@ -222,13 +234,22 @@ export class SignInUpService {
|
||||
|
||||
await this.userWorkspaceService.create(user.id, workspace.id);
|
||||
|
||||
if (user.firstName !== '' || user.lastName === '') {
|
||||
await this.onboardingService.toggleOnboardingCreateProfileCompletion({
|
||||
userId: user.id,
|
||||
workspaceId: workspace.id,
|
||||
value: true,
|
||||
});
|
||||
}
|
||||
await this.onboardingService.setOnboardingConnectAccountPending({
|
||||
userId: user.id,
|
||||
workspaceId: workspace.id,
|
||||
value: true,
|
||||
});
|
||||
|
||||
await this.onboardingService.setOnboardingCreateProfileCompletion({
|
||||
userId: user.id,
|
||||
workspaceId: workspace.id,
|
||||
value: true,
|
||||
});
|
||||
|
||||
await this.onboardingService.setOnboardingInviteTeamPending({
|
||||
workspaceId: workspace.id,
|
||||
value: true,
|
||||
});
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user