Rework locale computation on BE (#13247)

Context:

Users are complaining to see their workspace in a language they don't
know. This behavior is transient, happens on data model update and
disappear on refresh
I've check the cache for users that got the issue and did not spot any
weird language
==> I think we somehow fallback the the request header locale. I feel we
should always use the userWorkspace.locale, request locale should not be
used in BE in my opinion except for unauthenticated endpoints. I'm also
adding logs to understand the locale issue
In this PR:

rename user.workspaces into user.userWorkspaces which is more correct
improve / simplify LOCALES typing
This commit is contained in:
Charles Bochet
2025-07-16 18:51:46 +02:00
committed by GitHub
parent 7fde4944d8
commit b25f50e288
20 changed files with 119 additions and 78 deletions

View File

@ -49,7 +49,7 @@ export class LowercaseUserAndInvitationEmailsCommand extends ActiveOrSuspendedWo
private async lowercaseUserEmails(workspaceId: string, dryRun: boolean) {
const users = await this.userRepository.find({
where: {
workspaces: {
userWorkspaces: {
workspaceId,
},
email: Raw((alias) => `LOWER(${alias}) != ${alias}`),