Skip to content

Commit 1e5fce8

Browse files
authored
fix(dotcom): hide Move to submenu for linked files (tldraw#9245)
In order to avoid showing a control that does nothing, this PR hides the "Move to" submenu in the sidebar file menu for linked files — files the user doesn't own but has visited, which appear in "My workspace" and cannot be moved to another workspace. Previously the "Move to" submenu rendered for every file when workspaces were enabled. For a linked file, picking a destination workspace dispatched `moveFileToWorkspace`, which the server rejects because the user lacks `removeFiles` permission on the file's owning workspace. The menu options looked actionable but silently did nothing. The submenu is now gated on `hasAdminRights` (from `useHasFileAdminRights`), the same check already used for the rename item and the delete-vs-forget label. Linked files return `false` here, so the three owner-only actions are now consistently hidden together. ### Change type - [x] `bugfix` ### Test plan 1. Enable workspaces (`groups_frontend`). 2. Visit a file shared by another user so it appears under "My workspace" as a linked/guest file. 3. Open that file's menu in the sidebar and confirm there is no "Move to" submenu (and the action is "Forget", not "Delete"). 4. Open the menu for a file you own and confirm "Move to" still appears and works. ### Release notes - Hide the "Move to" submenu for linked files in the sidebar, since they can't be moved to another workspace.
1 parent 3656093 commit 1e5fce8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

apps/dotcom/client/src/tla/components/TlaFileMenu/TlaFileMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ export function FileItems({
240240
)}
241241
</TldrawUiMenuGroup>
242242
<TldrawUiMenuGroup id="file-delete">
243-
{workspacesEnabled && (
243+
{workspacesEnabled && hasAdminRights && (
244244
<TldrawUiMenuSubmenu id="move-to-workspace" label={'Move to'} size="small">
245245
<TldrawUiMenuGroup id="workspaces">
246246
<TldrawUiMenuCheckboxItem

0 commit comments

Comments
 (0)