Skip to content

The open alternative to Salesforce, designed for AI.

fix(server): persist user locale on userWorkspace create (#25098)

cfngc45946fbbf49ee21e
diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts
index f096a1f7d28..b166f5d3db9 100644
--- a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts
+++ b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts
@@ -721,6 +721,7 @@ export class SignInUpService {
: userData.newUserWithPicture.picture,
applicationUniversalIdentifier:
customApplication.universalIdentifier,
+ locale: user.locale,
},
queryRunner,
);
diff --git a/packages/twenty-server/src/engine/core-modules/user-workspace/user-workspace.service.ts b/packages/twenty-server/src/engine/core-modules/user-workspace/user-workspace.service.ts
index f1b9a35ca6c..69fde7c08da 100644
--- a/packages/twenty-server/src/engine/core-modules/user-workspace/user-workspace.service.ts
+++ b/packages/twenty-server/src/engine/core-modules/user-workspace/user-workspace.service.ts
@@ -124,12 +124,14 @@ export class UserWorkspaceService {
isExistingUser,
pictureUrl,
applicationUniversalIdentifier,
+ locale,
}: {
userId: string;
workspaceId: string;
isExistingUser: boolean;
pictureUrl?: string;
applicationUniversalIdentifier?: string;
+ locale?: UserWorkspaceEntity['locale'];
},
queryRunner?: QueryRunner,
): Promise<UserWorkspaceEntity> {
@@ -146,6 +148,7 @@ export class UserWorkspaceService {
userId,
workspaceId,
defaultAvatarUrl,
+ locale: locale ?? SOURCE_LOCALE,
});
return queryRunner
@@ -234,6 +237,7 @@ export class UserWorkspaceService {
userId: user.id,
workspaceId: workspace.id,
isExistingUser: true,
+ locale: user.locale,
});
await this.createWorkspaceMember(workspace.id, user);