🐛(frontend) hide leave option when unauthenticated

Leave was shown in the document menu for anonymous visitors.
Hide it unless the current user can actually leave the doc.

Signed-off-by: Mora <razvi.morariu.mihai@gmail.com>
This commit is contained in:
Mora
2026-09-04 09:04:12 +02:00
committed by Anthony LC
parent 059f1d004a
commit b32b3f08c2
3 changed files with 13 additions and 1 deletions
+4
View File
@@ -6,6 +6,10 @@ and this project adheres to
## [Unreleased]
### Fixed
- 🐛(frontend) hide Leave in the doc menu when not logged in #2626
## [v5.6.0] - 2026-09-03
### Added
@@ -247,6 +247,13 @@ test.describe('Doc Visibility: Public', () => {
await writeInEditor({ page, text: 'Can you see it ?' });
await expect(otherEditor.getByText('Can you see it ?')).toBeVisible();
await otherPage
.getByRole('button', { name: 'Open the document options' })
.click();
await expect(
otherPage.getByRole('menuitem', { name: 'Leave' }),
).toBeHidden();
await cleanup();
});
@@ -311,8 +311,9 @@ const DocToolBoxComponent = ({
* A user can only leave a top parent because we cannot
* leave a child if the parent is not left.
* ⚠️ This doc can still be a child for other users.
* Unauthenticated visitors also cannot leave.
*/
isHidden: !isTopParent,
isHidden: !isTopParent || !authenticated,
},
{
label: t('Delete', {