Commit 1e5fce8
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
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| |||
0 commit comments