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

Commit8772cf0

Browse files
committed
hopefully make the test green
1 parent15f7d35 commit8772cf0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

‎site/src/components/SettingsAccountForm/SettingsAccountForm.tsx

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

1010
exportinterfaceAccountFormValues{
11+
editable:boolean
1112
username:string
1213
}
1314

@@ -22,6 +23,7 @@ const validationSchema = Yup.object({
2223
})
2324

2425
exportinterfaceAccountFormProps{
26+
editable:boolean
2527
email:string
2628
isLoading:boolean
2729
initialValues:AccountFormValues
@@ -32,6 +34,7 @@ export interface AccountFormProps {
3234
}
3335

3436
exportconstAccountForm:FC<React.PropsWithChildren<AccountFormProps>>=({
37+
editable,
3538
email,
3639
isLoading,
3740
onSubmit,
@@ -63,6 +66,7 @@ export const AccountForm: FC<React.PropsWithChildren<AccountFormProps>> = ({
6366
{...getFieldHelpers("username")}
6467
onChange={onChangeTrimmed(form)}
6568
autoComplete="username"
69+
disabled={!editable}
6670
fullWidth
6771
label={Language.usernameLabel}
6872
variant="outlined"

‎site/src/pages/UserSettingsPage/AccountPage/AccountPage.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export const Language = {
1111
exportconstAccountPage:React.FC=()=>{
1212
constxServices=useContext(XServiceContext)
1313
const[authState,authSend]=useActor(xServices.authXService)
14-
const{ me, updateProfileError}=authState.context
14+
const{ me, permissions, updateProfileError}=authState.context
15+
constcanEditUsers=permissions&&permissions.updateUsers
1516

1617
if(!me){
1718
thrownewError("No current user found")
@@ -23,7 +24,11 @@ export const AccountPage: React.FC = () => {
2324
email={me.email}
2425
updateProfileError={updateProfileError}
2526
isLoading={authState.matches("signedIn.profile.updatingProfile")}
26-
initialValues={{username:me.username}}
27+
initialValues={{
28+
username:me.username,
29+
// Fail-open, as the API endpoint will check again on submit
30+
editable:canEditUsers||false,
31+
}}
2732
onSubmit={(data)=>{
2833
authSend({
2934
type:"UPDATE_PROFILE",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp