Skip to content

refactor: remove the user name #1185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions site/src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export interface UserResponse {
readonly username: string
readonly email: string
readonly created_at: string
readonly name: string
}

/**
Expand Down Expand Up @@ -100,5 +99,4 @@ export interface WorkspaceAutostopRequest {
export interface UpdateProfileRequest {
readonly username: string
readonly email: string
readonly name: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import { LoadingButton } from "../LoadingButton/LoadingButton"
import { Stack } from "../Stack/Stack"

interface AccountFormValues {
name: string
email: string
username: string
}

export const Language = {
nameLabel: "Name",
usernameLabel: "Username",
emailLabel: "Email",
emailInvalid: "Please enter a valid email address.",
Expand All @@ -24,7 +22,6 @@ export const Language = {

const validationSchema = Yup.object({
email: Yup.string().trim().email(Language.emailInvalid).required(Language.emailRequired),
name: Yup.string().optional(),
username: Yup.string().trim(),
})

Expand Down Expand Up @@ -55,14 +52,6 @@ export const AccountForm: React.FC<AccountFormProps> = ({
<>
<form onSubmit={form.handleSubmit}>
<Stack>
<TextField
{...getFieldHelpers("name")}
autoFocus
autoComplete="name"
fullWidth
label={Language.nameLabel}
variant="outlined"
/>
<TextField
{...getFieldHelpers("email")}
onChange={onChangeTrimmed(form)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ const renderPage = () => {
}

const newData = {
name: "User",
email: "user@coder.com",
username: "user",
}

const fillAndSubmitForm = async () => {
await waitFor(() => screen.findByLabelText("Name"))
fireEvent.change(screen.getByLabelText("Name"), { target: { value: newData.name } })
await waitFor(() => screen.findByLabelText("Email"))
fireEvent.change(screen.getByLabelText("Email"), { target: { value: newData.email } })
fireEvent.change(screen.getByLabelText("Username"), { target: { value: newData.username } })
fireEvent.click(screen.getByText(AccountForm.Language.updatePreferences))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const AccountPage: React.FC = () => {
error={hasUnknownError ? Language.unknownError : undefined}
formErrors={formErrors}
isLoading={authState.matches("signedIn.profile.updatingProfile")}
initialValues={{ name: me.name, username: me.username, email: me.email }}
initialValues={{ username: me.username, email: me.email }}
onSubmit={(data) => {
authSend({
type: "UPDATE_PROFILE",
Expand Down
2 changes: 0 additions & 2 deletions site/src/testHelpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const MockBuildInfo: BuildInfoResponse = {
}

export const MockUser: UserResponse = {
name: "Test User",
id: "test-user",
username: "TestUser",
email: "test@coder.com",
Expand All @@ -30,7 +29,6 @@ export const MockUser: UserResponse = {

export const MockUser2: UserResponse = {
id: "test-user-2",
name: "Test User 2",
username: "TestUser2",
email: "test2@coder.com",
created_at: "",
Expand Down