Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: UI only show edit username if user has capability#3648

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Emyrk wants to merge2 commits intomainfromstevenmasley/edit_username
Closed
Changes fromall 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
import TextField from "@material-ui/core/TextField"
import { useActor } from "@xstate/react"
import { ErrorSummary } from "components/ErrorSummary/ErrorSummary"
import { FormikContextType, FormikTouched, useFormik } from "formik"
import { FC } from "react"
import { FC, useContext } from "react"
import * as Yup from "yup"
import { getFormHelpersWithError, nameValidator, onChangeTrimmed } from "../../util/formUtils"
import { XServiceContext } from "../../xServices/StateContext"
import { LoadingButton } from "../LoadingButton/LoadingButton"
import { Stack } from "../Stack/Stack"

Expand DownExpand Up@@ -47,6 +49,13 @@ export const AccountForm: FC<AccountFormProps> = ({
})
const getFieldHelpers = getFormHelpersWithError<AccountFormValues>(form, updateProfileError)

const xServices = useContext(XServiceContext)
const [authState, _] = useActor(xServices.authXService)
const { permissions } = authState.context
// Editing user's emails is considered editing the "user" object.
// So we can only update the user's username if we have updateUser permission.
const canEditUsers = permissions && permissions.updateUsers

return (
<>
<form onSubmit={form.handleSubmit}>
Expand All@@ -66,6 +75,7 @@ export const AccountForm: FC<AccountFormProps> = ({
fullWidth
label={Language.usernameLabel}
variant="outlined"
disabled={!canEditUsers}
/>

<div>
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp