mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
refactor: remove the user name (#1185)
This commit is contained in:
@ -15,7 +15,6 @@ export interface UserResponse {
|
||||
readonly username: string
|
||||
readonly email: string
|
||||
readonly created_at: string
|
||||
readonly name: string
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,5 +99,4 @@ export interface WorkspaceAutostopRequest {
|
||||
export interface UpdateProfileRequest {
|
||||
readonly username: string
|
||||
readonly email: string
|
||||
readonly name: string
|
||||
}
|
||||
|
@ -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.",
|
||||
@ -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(),
|
||||
})
|
||||
|
||||
@ -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)}
|
||||
|
@ -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))
|
||||
|
@ -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",
|
||||
|
@ -21,7 +21,6 @@ export const MockBuildInfo: BuildInfoResponse = {
|
||||
}
|
||||
|
||||
export const MockUser: UserResponse = {
|
||||
name: "Test User",
|
||||
id: "test-user",
|
||||
username: "TestUser",
|
||||
email: "test@coder.com",
|
||||
@ -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: "",
|
||||
|
Reference in New Issue
Block a user