diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx
index 54659d742..d7daf5fbb 100644
--- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx
+++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx
@@ -225,9 +225,12 @@ export const ActionBar = memo(
variant='ghost'
onClick={(e) => {
e.stopPropagation()
- collaborativeBatchToggleLocked([blockId])
+ if (!disabled) {
+ collaborativeBatchToggleLocked([blockId])
+ }
}}
className={ACTION_BUTTON_STYLES}
+ disabled={disabled}
>
{isLocked ? : }
@@ -319,18 +322,18 @@ export const ActionBar = memo(
variant='ghost'
onClick={(e) => {
e.stopPropagation()
- if (!disabled && !isLocked) {
+ if (!disabled && !isLocked && !isParentLocked) {
collaborativeBatchRemoveBlocks([blockId])
}
}}
className={ACTION_BUTTON_STYLES}
- disabled={disabled || isLocked}
+ disabled={disabled || isLocked || isParentLocked}
>
- {isLocked ? 'Block is locked' : getTooltipMessage('Delete Block')}
+ {isLocked || isParentLocked ? 'Block is locked' : getTooltipMessage('Delete Block')}
diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/editor.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/editor.tsx
index 742e17c0c..a5b769dfd 100644
--- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/editor.tsx
+++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/editor.tsx
@@ -368,11 +368,11 @@ export function Editor() {
)}
- {/* Locked indicator - clickable to unlock if user has admin permissions */}
+ {/* Locked indicator - clickable to unlock if user has admin permissions and block itself is locked */}
{isLocked && currentBlock && (
- {userPermissions.canAdmin ? (
+ {userPermissions.canAdmin && currentBlock.locked ? (
)}
diff --git a/apps/sim/socket/database/operations.ts b/apps/sim/socket/database/operations.ts
index faf3d3176..b2491f1e4 100644
--- a/apps/sim/socket/database/operations.ts
+++ b/apps/sim/socket/database/operations.ts
@@ -778,8 +778,10 @@ async function handleBlocksOperationTx(
}
}
- // Determine target enabled state based on first block
- const firstBlock = blocksById[blockIds[0]]
+ // Determine target enabled state based on first toggleable block
+ if (blocksToToggle.size === 0) break
+ const firstToggleableId = Array.from(blocksToToggle)[0]
+ const firstBlock = blocksById[firstToggleableId]
if (!firstBlock) break
const targetEnabled = !firstBlock.enabled