mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-05 13:37:38 +03:00
Fix User delete button not showing
This commit is contained in:
parent
b8138ebad6
commit
ad153f5f63
1 changed files with 6 additions and 4 deletions
|
@ -29,10 +29,10 @@ const UserTitle = ({ record }) => {
|
||||||
return <Title subTitle={`${resourceName} ${record ? record.name : ''}`} />
|
return <Title subTitle={`${resourceName} ${record ? record.name : ''}`} />
|
||||||
}
|
}
|
||||||
|
|
||||||
const UserToolbar = (props) => (
|
const UserToolbar = ({ showDelete, ...props }) => (
|
||||||
<Toolbar {...props} classes={useStyles()}>
|
<Toolbar {...props} classes={useStyles()}>
|
||||||
<SaveButton disabled={props.pristine} />
|
<SaveButton disabled={props.pristine} />
|
||||||
{props.permissions === 'admin' && <DeleteUserButton />}
|
{showDelete && <DeleteUserButton />}
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -40,16 +40,18 @@ const UserEdit = (props) => {
|
||||||
const { permissions } = props
|
const { permissions } = props
|
||||||
const translate = useTranslate()
|
const translate = useTranslate()
|
||||||
|
|
||||||
|
const isMyself = props.id === localStorage.getItem('userId')
|
||||||
const getNameHelperText = () =>
|
const getNameHelperText = () =>
|
||||||
props.id === localStorage.getItem('userId') && {
|
isMyself && {
|
||||||
helperText: translate('resources.user.helperTexts.name'),
|
helperText: translate('resources.user.helperTexts.name'),
|
||||||
}
|
}
|
||||||
|
const canDelete = permissions === 'admin' && !isMyself
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Edit title={<UserTitle />} {...props}>
|
<Edit title={<UserTitle />} {...props}>
|
||||||
<SimpleForm
|
<SimpleForm
|
||||||
variant={'outlined'}
|
variant={'outlined'}
|
||||||
toolbar={<UserToolbar />}
|
toolbar={<UserToolbar showDelete={canDelete} />}
|
||||||
redirect={permissions === 'admin' ? 'list' : false}
|
redirect={permissions === 'admin' ? 'list' : false}
|
||||||
>
|
>
|
||||||
{permissions === 'admin' && (
|
{permissions === 'admin' && (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue