Skip to content

Commit 454ccf7

Browse files
refactor: remove the user name (#1185)
1 parent 22668c3 commit 454ccf7

File tree

5 files changed

+2
-19
lines changed

5 files changed

+2
-19
lines changed

site/src/api/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export interface UserResponse {
1515
readonly username: string
1616
readonly email: string
1717
readonly created_at: string
18-
readonly name: string
1918
}
2019

2120
/**
@@ -100,5 +99,4 @@ export interface WorkspaceAutostopRequest {
10099
export interface UpdateProfileRequest {
101100
readonly username: string
102101
readonly email: string
103-
readonly name: string
104102
}

site/src/components/PreferencesAccountForm/PreferencesAccountForm.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ import { LoadingButton } from "../LoadingButton/LoadingButton"
88
import { Stack } from "../Stack/Stack"
99

1010
interface AccountFormValues {
11-
name: string
1211
email: string
1312
username: string
1413
}
1514

1615
export const Language = {
17-
nameLabel: "Name",
1816
usernameLabel: "Username",
1917
emailLabel: "Email",
2018
emailInvalid: "Please enter a valid email address.",
@@ -24,7 +22,6 @@ export const Language = {
2422

2523
const validationSchema = Yup.object({
2624
email: Yup.string().trim().email(Language.emailInvalid).required(Language.emailRequired),
27-
name: Yup.string().optional(),
2825
username: Yup.string().trim(),
2926
})
3027

@@ -55,14 +52,6 @@ export const AccountForm: React.FC<AccountFormProps> = ({
5552
<>
5653
<form onSubmit={form.handleSubmit}>
5754
<Stack>
58-
<TextField
59-
{...getFieldHelpers("name")}
60-
autoFocus
61-
autoComplete="name"
62-
fullWidth
63-
label={Language.nameLabel}
64-
variant="outlined"
65-
/>
6655
<TextField
6756
{...getFieldHelpers("email")}
6857
onChange={onChangeTrimmed(form)}

site/src/pages/PreferencesPages/AccountPage/AccountPage.test.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ const renderPage = () => {
1717
}
1818

1919
const newData = {
20-
name: "User",
2120
email: "user@coder.com",
2221
username: "user",
2322
}
2423

2524
const fillAndSubmitForm = async () => {
26-
await waitFor(() => screen.findByLabelText("Name"))
27-
fireEvent.change(screen.getByLabelText("Name"), { target: { value: newData.name } })
25+
await waitFor(() => screen.findByLabelText("Email"))
2826
fireEvent.change(screen.getByLabelText("Email"), { target: { value: newData.email } })
2927
fireEvent.change(screen.getByLabelText("Username"), { target: { value: newData.username } })
3028
fireEvent.click(screen.getByText(AccountForm.Language.updatePreferences))

site/src/pages/PreferencesPages/AccountPage/AccountPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const AccountPage: React.FC = () => {
3030
error={hasUnknownError ? Language.unknownError : undefined}
3131
formErrors={formErrors}
3232
isLoading={authState.matches("signedIn.profile.updatingProfile")}
33-
initialValues={{ name: me.name, username: me.username, email: me.email }}
33+
initialValues={{ username: me.username, email: me.email }}
3434
onSubmit={(data) => {
3535
authSend({
3636
type: "UPDATE_PROFILE",

site/src/testHelpers/entities.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export const MockBuildInfo: BuildInfoResponse = {
2121
}
2222

2323
export const MockUser: UserResponse = {
24-
name: "Test User",
2524
id: "test-user",
2625
username: "TestUser",
2726
email: "test@coder.com",
@@ -30,7 +29,6 @@ export const MockUser: UserResponse = {
3029

3130
export const MockUser2: UserResponse = {
3231
id: "test-user-2",
33-
name: "Test User 2",
3432
username: "TestUser2",
3533
email: "test2@coder.com",
3634
created_at: "",

0 commit comments

Comments
 (0)