Skip to content

Commit bd36283

Browse files
waleedlatif1claude
andcommitted
fix(lock): prevent unlocking blocks inside locked containers
- Editor: can't unlock block if parent container is locked - Action bar: can't unlock block if parent container is locked - Shows "Parent container is locked" tooltip in both cases Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 73856af commit bd36283

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,17 +225,24 @@ export const ActionBar = memo(
225225
variant='ghost'
226226
onClick={(e) => {
227227
e.stopPropagation()
228-
if (!disabled) {
228+
// Can't unlock a block if its parent container is locked
229+
if (!disabled && !(isLocked && isParentLocked)) {
229230
collaborativeBatchToggleLocked([blockId])
230231
}
231232
}}
232233
className={ACTION_BUTTON_STYLES}
233-
disabled={disabled}
234+
disabled={disabled || (isLocked && isParentLocked)}
234235
>
235236
{isLocked ? <Unlock className={ICON_SIZE} /> : <Lock className={ICON_SIZE} />}
236237
</Button>
237238
</Tooltip.Trigger>
238-
<Tooltip.Content side='top'>{isLocked ? 'Unlock Block' : 'Lock Block'}</Tooltip.Content>
239+
<Tooltip.Content side='top'>
240+
{isLocked && isParentLocked
241+
? 'Parent container is locked'
242+
: isLocked
243+
? 'Unlock Block'
244+
: 'Lock Block'}
245+
</Tooltip.Content>
239246
</Tooltip.Root>
240247
)}
241248

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/editor.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,11 @@ export function Editor() {
368368
)}
369369
</div>
370370
<div className='flex shrink-0 items-center gap-[8px]'>
371-
{/* Locked indicator - clickable to unlock if user has admin permissions and block itself is locked */}
371+
{/* Locked indicator - clickable to unlock if user has admin permissions, block is locked, and parent is not locked */}
372372
{isLocked && currentBlock && (
373373
<Tooltip.Root>
374374
<Tooltip.Trigger asChild>
375-
{userPermissions.canAdmin && currentBlock.locked ? (
375+
{userPermissions.canAdmin && currentBlock.locked && !isParentLocked ? (
376376
<Button
377377
variant='ghost'
378378
className='p-0'
@@ -389,10 +389,10 @@ export function Editor() {
389389
</Tooltip.Trigger>
390390
<Tooltip.Content side='top'>
391391
<p>
392-
{userPermissions.canAdmin && currentBlock.locked
393-
? 'Unlock block'
394-
: isParentLocked
395-
? 'Parent container is locked'
392+
{isParentLocked
393+
? 'Parent container is locked'
394+
: userPermissions.canAdmin && currentBlock.locked
395+
? 'Unlock block'
396396
: 'Block is locked'}
397397
</p>
398398
</Tooltip.Content>

0 commit comments

Comments
 (0)