Fix wrong getAll keyValue method (#8603)
Fixes https://github.com/twentyhq/twenty/issues/8520#issuecomment-2485913500 - Fix the getAll key-value pairs method, as it returns incorrect results. The keyVar values were being affected by keyValues from other workspaces. - Fix missing Sync Email step for existing users joining existing workspace Before, this method returned keyValues that verifies: - workspaceId = user.defaultWorkspaceId - userId = user.id This method now returns: - userId = null && workspaceId = user.defaultWorkspaceId - userId = user.id && workspaceId = null - userId = user.id && workspaceId = user.defaultWorkspaceId ## Result https://github.com/user-attachments/assets/b7563db6-a6a8-4e09-a0c6-c372d7e2b712
This commit is contained in:
@ -209,12 +209,10 @@ export class SignInUpService {
|
||||
)
|
||||
: await this.userWorkspaceService.addUserToWorkspace(user, workspace);
|
||||
|
||||
if (isNewUser) {
|
||||
await this.activateOnboardingForNewUser(user, workspace, {
|
||||
firstName,
|
||||
lastName,
|
||||
});
|
||||
}
|
||||
await this.activateOnboardingForUser(user, workspace, {
|
||||
firstName,
|
||||
lastName,
|
||||
});
|
||||
|
||||
return Object.assign(user, updatedUser);
|
||||
}
|
||||
@ -266,7 +264,7 @@ export class SignInUpService {
|
||||
return workspace;
|
||||
}
|
||||
|
||||
private async activateOnboardingForNewUser(
|
||||
private async activateOnboardingForUser(
|
||||
user: User,
|
||||
workspace: Workspace,
|
||||
{ firstName, lastName }: { firstName: string; lastName: string },
|
||||
@ -331,20 +329,11 @@ export class SignInUpService {
|
||||
|
||||
await this.userWorkspaceService.create(user.id, workspace.id);
|
||||
|
||||
await this.onboardingService.setOnboardingConnectAccountPending({
|
||||
userId: user.id,
|
||||
workspaceId: workspace.id,
|
||||
value: true,
|
||||
await this.activateOnboardingForUser(user, workspace, {
|
||||
firstName,
|
||||
lastName,
|
||||
});
|
||||
|
||||
if (firstName === '' && lastName === '') {
|
||||
await this.onboardingService.setOnboardingCreateProfilePending({
|
||||
userId: user.id,
|
||||
workspaceId: workspace.id,
|
||||
value: true,
|
||||
});
|
||||
}
|
||||
|
||||
await this.onboardingService.setOnboardingInviteTeamPending({
|
||||
workspaceId: workspace.id,
|
||||
value: true,
|
||||
|
||||
Reference in New Issue
Block a user