fix(sidebar): pass showDelete to hide delete menu for non-admin members#4696
fix(sidebar): pass showDelete to hide delete menu for non-admin members#4696minijeong-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 a0bd149. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR fixes a UX/permission mismatch where Write and Read workspace members could see a Delete option in the workflow/folder context menus, even though the DELETE API enforces admin-only access and returns 403 for non-admins. The fix passes
Confidence Score: 5/5Safe to merge — the change correctly hides a destructive action from users who cannot perform it, and the existing API-level enforcement remains intact as a backstop. Both changed call sites are symmetric and consistent with how other show* props are already used in the same component. The disableDelete simplification is correct because admins (the only users who now see the button) always have edit permission, so removing !userPermissions.canEdit from that check has no practical effect. The canDeleteSelection and effectiveLocked guards remain, preserving the last-workflow and lock protections. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User right-clicks workflow/folder] --> B{userPermissions.canAdmin?}
B -- No --> C[showDelete = false\nDelete option hidden]
B -- Yes --> D[showDelete = true\nDelete option visible]
D --> E{disableDelete?\neffectiveLocked OR !canDeleteSelection}
E -- Yes --> F[Delete option shown but disabled]
E -- No --> G[Delete option shown and enabled]
G --> H[User clicks Delete]
H --> I[DELETE API called\naction: 'admin' enforced]
I --> J[200 OK — item deleted]
Reviews (1): Last reviewed commit: "fix(sidebar): pass showDelete to hide de..." | Re-trigger Greptile |
|
Closing - will reopen against staging branch per contribution guidelines. |
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