From da516ae8a8cab8a246097a136f51886491ca26fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matja=C5=BE=20Horvat?= Date: Wed, 6 Nov 2024 07:51:39 +0100 Subject: [PATCH] Unify user data API between server and frontend (#3432) * Unify position of the "email" key/property between backend and various frontend definitions * Add missing "theme" key to the ApiUserData type --- translate/src/api/user.ts | 3 ++- translate/src/modules/user/reducer.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/translate/src/api/user.ts b/translate/src/api/user.ts index aa18acc1c..8d5439725 100644 --- a/translate/src/api/user.ts +++ b/translate/src/api/user.ts @@ -27,9 +27,9 @@ export type ApiUserData = { is_admin?: boolean; is_pm?: boolean; id?: string; + email?: string; display_name?: string; name_or_email?: string; - email?: string; username?: string; date_joined?: string; can_manage_locales?: string[]; @@ -51,6 +51,7 @@ export type ApiUserData = { notifications: Notification[]; unread_count: string; }; + theme?: string; }; /** All users for use in mentions suggestions within comments */ diff --git a/translate/src/modules/user/reducer.ts b/translate/src/modules/user/reducer.ts index 1433be0c0..f1e7ebe1a 100644 --- a/translate/src/modules/user/reducer.ts +++ b/translate/src/modules/user/reducer.ts @@ -69,9 +69,9 @@ export type UserState = { readonly isAdmin: boolean; readonly isPM: boolean; readonly id: string; + readonly email: string; readonly displayName: string; readonly nameOrEmail: string; - readonly email: string; readonly username: string; readonly dateJoined: string; readonly canManageLocales: Array; @@ -97,9 +97,9 @@ const initial: UserState = { isAdmin: false, isPM: false, id: '', + email: '', displayName: '', nameOrEmail: '', - email: '', username: '', dateJoined: '', canManageLocales: [],