fix(sidebar): pass showDelete to hide delete menu for non-admin members#4697
fix(sidebar): pass showDelete to hide delete menu for non-admin members#4697minijeong-log wants to merge 1 commit into
Conversation
The ContextMenu component already has a showDelete prop with conditional
rendering, but workflow-item and folder-item never pass it, leaving it
at the default value of true. This causes write members to see an active
Delete option that always fails with 403, since the DELETE API requires
admin permission.
Pass showDelete={userPermissions.canAdmin} from both workflow-item and
folder-item so that non-admin users no longer see the Delete menu.
Simplify disableDelete to only check canDeleteSelection and
effectiveLocked, since permission gating is now handled by showDelete.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Simplifies Reviewed by Cursor Bugbot for commit b7f6407. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR fixes a UX bug where non-admin workspace members (write/read) could see a Delete option in the workflow and folder context menus, even though the underlying DELETE API enforces an admin permission check and would always return 403 for them. The fix passes
Confidence Score: 5/5Minimal, targeted change that wires an existing visibility prop to hide a menu item for non-admin users; no logic paths are added or removed beyond what is necessary. Both files make the same two-line surgical change. The ContextMenu component already handles showDelete=false correctly — the item is not rendered and the surrounding separator is suppressed via (showLeave || showDelete). Dropping !userPermissions.canEdit from disableDelete is safe because canAdmin implies canEdit in this permission model, and canDeleteSelection/effectiveLocked still gate the disabled state for admins who need it. No files require special attention; both changed files make identical, self-contained prop additions. Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User (non-admin)
participant WI as WorkflowItem / FolderItem
participant CM as ContextMenu
participant API as DELETE API
U->>WI: Right-click (context menu)
WI->>CM: "showDelete={canAdmin=false}"
CM-->>U: Delete item hidden (not rendered)
Note over U,API: No 403 error ever reached
participant A as Admin User
A->>WI: Right-click (context menu)
WI->>CM: "showDelete={canAdmin=true}, disableDelete={locked||!canDelete}"
CM-->>A: Delete item visible (enabled or disabled)
A->>API: DELETE /workflow/:id
API-->>A: 200 OK
Reviews (1): Last reviewed commit: "fix(sidebar): pass showDelete to hide de..." | Re-trigger Greptile |
Summary
Fixes #4695
Write/Read workspace members see the Delete option in the workflow/folder context menu, but the DELETE API enforces
action: 'admin', so it always fails with 403. TheContextMenucomponent already has ashowDeleteprop with conditional rendering, butworkflow-itemandfolder-itemnever pass it, leaving it at the defaulttrue.This PR passes
showDelete={userPermissions.canAdmin}from both components so non-admin users no longer see the Delete menu.disableDeleteis simplified to only checkcanDeleteSelectionandeffectiveLocked, since permission gating is now handled byshowDelete.Type of Change
Testing
permissionstableChecklist