diff options
Diffstat (limited to 'modern')
-rw-r--r-- | modern/src/common/util/permissions.js | 7 | ||||
-rw-r--r-- | modern/src/settings/components/EditCollectionView.js | 6 |
2 files changed, 3 insertions, 10 deletions
diff --git a/modern/src/common/util/permissions.js b/modern/src/common/util/permissions.js index a18644a8..34aeb89d 100644 --- a/modern/src/common/util/permissions.js +++ b/modern/src/common/util/permissions.js @@ -26,10 +26,3 @@ export const useDeviceReadonly = () => useSelector((state) => { const userDeviceReadonly = state.session.user?.deviceReadonly; return !admin && (serverReadonly || userReadonly || serverDeviceReadonly || userDeviceReadonly); }); - -export const useEditable = () => useSelector((state) => { - const admin = state.session.user?.administrator; - const serverReadonly = state.session.server?.readonly; - const userReadonly = state.session.user?.readonly; - return admin || (!serverReadonly && !userReadonly); -}); diff --git a/modern/src/settings/components/EditCollectionView.js b/modern/src/settings/components/EditCollectionView.js index 9107b68e..ed92c838 100644 --- a/modern/src/settings/components/EditCollectionView.js +++ b/modern/src/settings/components/EditCollectionView.js @@ -9,7 +9,7 @@ import AddIcon from '@material-ui/icons/Add'; import RemoveDialog from '../../common/components/RemoveDialog'; import { useTranslation } from '../../common/components/LocalizationProvider'; import dimensions from '../../common/theme/dimensions'; -import { useEditable } from '../../common/util/permissions'; +import { useReadonly } from '../../common/util/permissions'; const useStyles = makeStyles((theme) => ({ fab: { @@ -29,7 +29,7 @@ const EditCollectionView = ({ const history = useHistory(); const t = useTranslation(); - const editable = useEditable(); + const readonly = useReadonly(); const [selectedId, setSelectedId] = useState(null); const [selectedAnchorEl, setSelectedAnchorEl] = useState(null); @@ -70,7 +70,7 @@ const EditCollectionView = ({ return ( <> <Content updateTimestamp={updateTimestamp} onMenuClick={menuShow} filter={filter} /> - {editable && !disableAdd && ( + {!readonly && !disableAdd && ( <Fab size="medium" color="primary" className={classes.fab} onClick={handleAdd}> <AddIcon /> </Fab> |