mirror of
https://github.com/simstudioai/sim.git
synced 2026-10-24 11:36:37 +08:00
fix(sidebar): pass showDelete to hide delete menu for non-admin members (#4697)
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.
This commit is contained in:
+2
-1
@@ -612,7 +612,8 @@ export function FolderItem({
|
||||
!userPermissions.canEdit || isDuplicatingSelection || !hasExportableContent
|
||||
}
|
||||
disableExport={!userPermissions.canEdit || isExporting || !hasExportableContent}
|
||||
disableDelete={!userPermissions.canEdit || effectiveLocked || !canDeleteSelection}
|
||||
showDelete={userPermissions.canAdmin}
|
||||
disableDelete={effectiveLocked || !canDeleteSelection}
|
||||
onToggleLock={handleToggleLock}
|
||||
showLock={!isMixedSelection && selectedFolders.size <= 1}
|
||||
disableLock={!userPermissions.canAdmin || inheritedFolderLocked}
|
||||
|
||||
+2
-1
@@ -524,7 +524,8 @@ export function WorkflowItem({
|
||||
disableDuplicate={!userPermissions.canEdit || isDuplicatingSelection}
|
||||
disableExport={!userPermissions.canEdit}
|
||||
disableColorChange={!userPermissions.canEdit || effectiveLocked}
|
||||
disableDelete={!userPermissions.canEdit || !canDeleteSelection || effectiveLocked}
|
||||
showDelete={userPermissions.canAdmin}
|
||||
disableDelete={!canDeleteSelection || effectiveLocked}
|
||||
onToggleLock={handleToggleLock}
|
||||
showLock={!isMixedSelection && selectedWorkflows.size <= 1}
|
||||
disableLock={!userPermissions.canAdmin || inheritedFolderLocked}
|
||||
|
||||
Reference in New Issue
Block a user