🐛(frontend) fix legacy role computation
Before the subpages feature, the user_role was computed thanks to the abilities. This is not the correct way to do it anymore, the abilities are now different. We now have "user_role" in the doc response which is the correct way to get the user role for the current document.
This commit is contained in:
@@ -238,17 +238,7 @@ test.describe('Doc Editor', () => {
|
||||
|
||||
test('it cannot edit if viewer', async ({ page }) => {
|
||||
await mockedDocument(page, {
|
||||
abilities: {
|
||||
destroy: false, // Means not owner
|
||||
link_configuration: false,
|
||||
versions_destroy: false,
|
||||
versions_list: true,
|
||||
versions_retrieve: true,
|
||||
accesses_manage: false, // Means not admin
|
||||
update: false,
|
||||
partial_update: false, // Means not editor
|
||||
retrieve: true,
|
||||
},
|
||||
user_role: 'reader',
|
||||
});
|
||||
|
||||
await goToGridDoc(page);
|
||||
@@ -257,6 +247,9 @@ test.describe('Doc Editor', () => {
|
||||
await expect(card).toBeVisible();
|
||||
|
||||
await expect(card.getByText('Reader')).toBeVisible();
|
||||
|
||||
const editor = page.locator('.ProseMirror');
|
||||
await expect(editor).toHaveAttribute('contenteditable', 'false');
|
||||
});
|
||||
|
||||
test('it adds an image to the doc editor', async ({ page, browserName }) => {
|
||||
|
||||
@@ -235,6 +235,12 @@ test.describe('Doc Tree', () => {
|
||||
'doc-tree-detach-child',
|
||||
);
|
||||
|
||||
await expect(
|
||||
page
|
||||
.getByLabel('It is the card information about the document.')
|
||||
.getByText('Administrator ·'),
|
||||
).toBeVisible();
|
||||
|
||||
const docTree = page.getByTestId('doc-tree');
|
||||
await expect(docTree.getByText(docChild)).toBeVisible();
|
||||
await docTree.click();
|
||||
|
||||
Reference in New Issue
Block a user