Skip to content

Commit aefbc2e

Browse files
committed
🛂(frontend) hide version restore button when reader
When you are a reader member, you have the right to see the version but you cannot restore them. So, we hide the restore button when you are a reader.
1 parent 15dc1e3 commit aefbc2e

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to
1111

1212
## Changed
1313

14+
- 🛂(frontend) Restore version visibility #629
1415
- 📝(doc) minor README.md formatting and wording enhancements
1516
- ♻️Stop setting a default title on doc creation #634
1617

src/frontend/apps/impress/src/features/docs/doc-versioning/components/ModalSelectVersion.tsx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ export const ModalSelectVersion = ({
3636
const { t } = useTranslation();
3737
const [selectedVersionId, setSelectedVersionId] =
3838
useState<Versions['version_id']>();
39-
39+
const canRestore = doc.abilities.partial_update;
4040
const restoreModal = useModal();
41+
4142
return (
4243
<>
4344
<Modal
@@ -127,21 +128,23 @@ export const ModalSelectVersion = ({
127128
selectedVersionId={selectedVersionId}
128129
/>
129130
</Box>
130-
<Box
131-
$padding="xs"
132-
$css={css`
133-
border-top: 1px solid var(--c--theme--colors--greyscale-200);
134-
`}
135-
>
136-
<Button
137-
fullWidth
138-
disabled={!selectedVersionId}
139-
onClick={restoreModal.open}
140-
color="primary"
131+
{canRestore && (
132+
<Box
133+
$padding="xs"
134+
$css={css`
135+
border-top: 1px solid var(--c--theme--colors--greyscale-200);
136+
`}
141137
>
142-
{t('Restore')}
143-
</Button>
144-
</Box>
138+
<Button
139+
fullWidth
140+
disabled={!selectedVersionId}
141+
onClick={restoreModal.open}
142+
color="primary"
143+
>
144+
{t('Restore')}
145+
</Button>
146+
</Box>
147+
)}
145148
</Box>
146149
</Box>
147150
</Modal>

0 commit comments

Comments
 (0)