Skip install-apps onboarding step for invited users (#22823)
## What The onboarding "install apps" step was proposed to every new user, including those joining an existing workspace through an invitation link. Now it is only proposed to the user who creates the workspace. ## Why App installation only makes sense for the workspace creator. Invited members should go straight to profile creation. ## How `activateOnboardingForUser` set the `ONBOARDING_INSTALL_APPS_PENDING` flag unconditionally, and that flag is the sole driver of the `APPS_INSTALLATION` status (the frontend just follows the backend status). Gated the setter behind a new `shouldShowInstallAppsStep` flag, mirroring the existing `shouldShowConnectAccountStep` flag: creator path passes `true`, join path (personal invitation, public invite link, SSO into an existing workspace) passes `false`. Backend-only change, no migration needed. Covered by unit tests for both branches. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/22823?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
This commit is contained in:
+40
-3
@@ -32,7 +32,7 @@ const createSignInUpServiceForTests = () => {
|
||||
|
||||
const mockWorkspaceRepository = {
|
||||
count: jest.fn(),
|
||||
create: jest.fn(),
|
||||
create: jest.fn((workspace) => workspace),
|
||||
};
|
||||
|
||||
const mockConfigurationValues: MockConfigurationValues = {
|
||||
@@ -50,7 +50,8 @@ const createSignInUpServiceForTests = () => {
|
||||
|
||||
const queryRunnerMock = {
|
||||
manager: {
|
||||
save: jest.fn(),
|
||||
save: jest.fn((_entity, entity) => entity),
|
||||
update: jest.fn(),
|
||||
},
|
||||
connect: jest.fn(),
|
||||
startTransaction: jest.fn(),
|
||||
@@ -101,7 +102,9 @@ const createSignInUpServiceForTests = () => {
|
||||
invalidateAndRecompute: jest.fn(),
|
||||
} as any,
|
||||
{
|
||||
createWorkspaceCustomApplication: jest.fn(),
|
||||
createWorkspaceCustomApplication: jest.fn().mockResolvedValue({
|
||||
universalIdentifier: 'custom-application-universal-identifier',
|
||||
}),
|
||||
} as any,
|
||||
{
|
||||
uploadWorkspaceLogoFromUrl: jest.fn(),
|
||||
@@ -122,6 +125,9 @@ const createSignInUpServiceForTests = () => {
|
||||
} as any,
|
||||
{
|
||||
createQueryRunner: jest.fn(() => queryRunnerMock),
|
||||
transaction: jest.fn(async (runInTransaction) =>
|
||||
runInTransaction({ queryRunner: queryRunnerMock }),
|
||||
),
|
||||
} as any,
|
||||
);
|
||||
|
||||
@@ -349,4 +355,35 @@ describe('SignInUpService onboarding steps', () => {
|
||||
mockOnboardingService.setOnboardingConnectAccountPending,
|
||||
).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('flags the install-apps step for a user creating a new workspace', async () => {
|
||||
const {
|
||||
service,
|
||||
mockOnboardingService,
|
||||
mockWorkspaceRepository,
|
||||
mockUserRepository,
|
||||
} = createSignInUpServiceForTests();
|
||||
|
||||
mockWorkspaceRepository.count.mockResolvedValue(0);
|
||||
mockUserRepository.count.mockResolvedValue(0);
|
||||
|
||||
await service.signUpOnNewWorkspace(
|
||||
{
|
||||
type: 'newUserWithPicture',
|
||||
newUserWithPicture: {
|
||||
email: 'creator@gmail.com',
|
||||
firstName: 'Creator',
|
||||
lastName: 'User',
|
||||
},
|
||||
},
|
||||
{ displayName: 'Acme Inc' },
|
||||
);
|
||||
|
||||
expect(
|
||||
mockOnboardingService.setOnboardingInstallAppsPending,
|
||||
).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ value: true }),
|
||||
expect.anything(),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user