🛂(frontend) right pad delete
Manage the right on the pad delete. If a use cannot delete a pad, we will not display the delete button in the dropdown menu.
This commit is contained in:
@@ -10,6 +10,7 @@ and this project adheres to
|
|||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
|
- Manage the document's right (#75)
|
||||||
- Update document (#68)
|
- Update document (#68)
|
||||||
- Remove document (#68)
|
- Remove document (#68)
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,10 @@ test.describe('Pad Tools', () => {
|
|||||||
await expect(panel.locator('li').getByText(randomPad)).toBeHidden();
|
await expect(panel.locator('li').getByText(randomPad)).toBeHidden();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it cannot update if not the owner', async ({ page, browserName }) => {
|
test('it cannot update or delete if not the owner', async ({
|
||||||
|
page,
|
||||||
|
browserName,
|
||||||
|
}) => {
|
||||||
const [padName] = await createPad(
|
const [padName] = await createPad(
|
||||||
page,
|
page,
|
||||||
'pad-tools-right-management',
|
'pad-tools-right-management',
|
||||||
@@ -166,5 +169,8 @@ test.describe('Pad Tools', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
page.getByRole('button', { name: 'Update document' }),
|
page.getByRole('button', { name: 'Update document' }),
|
||||||
).toBeHidden();
|
).toBeHidden();
|
||||||
|
await expect(
|
||||||
|
page.getByRole('button', { name: 'Delete document' }),
|
||||||
|
).toBeHidden();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -72,25 +72,15 @@ export const PadToolBox = ({ pad }: PadToolBoxProps) => {
|
|||||||
{pad.abilities.destroy && (
|
{pad.abilities.destroy && (
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsModalUpdateOpen(true);
|
setIsModalRemoveOpen(true);
|
||||||
setIsDropOpen(false);
|
setIsDropOpen(false);
|
||||||
}}
|
}}
|
||||||
color="primary-text"
|
color="primary-text"
|
||||||
icon={<span className="material-icons">edit</span>}
|
icon={<span className="material-icons">delete</span>}
|
||||||
>
|
>
|
||||||
<Text $theme="primary">{t('Update document')}</Text>
|
<Text $theme="primary">{t('Delete document')}</Text>
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<Button
|
|
||||||
onClick={() => {
|
|
||||||
setIsModalRemoveOpen(true);
|
|
||||||
setIsDropOpen(false);
|
|
||||||
}}
|
|
||||||
color="primary-text"
|
|
||||||
icon={<span className="material-icons">delete</span>}
|
|
||||||
>
|
|
||||||
<Text $theme="primary">{t('Delete document')}</Text>
|
|
||||||
</Button>
|
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsModalPDFOpen(true);
|
setIsModalPDFOpen(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user