( blockId: string, blocks: Record<string, WorkflowLockBlock> )
| 100 | * Checks whether any parent container in a block's ancestry is locked. |
| 101 | */ |
| 102 | export function isWorkflowBlockAncestorLocked( |
| 103 | blockId: string, |
| 104 | blocks: Record<string, WorkflowLockBlock> |
| 105 | ): boolean { |
| 106 | const visited = new Set<string>() |
| 107 | let parentId = getWorkflowBlockParentId(blocks[blockId]) |
| 108 | |
| 109 | while (parentId && !visited.has(parentId)) { |
| 110 | visited.add(parentId) |
| 111 | const parent = blocks[parentId] |
| 112 | if (!parent) return false |
| 113 | if (parent.locked) return true |
| 114 | parentId = getWorkflowBlockParentId(parent) |
| 115 | } |
| 116 | |
| 117 | return false |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Checks whether a block is locked directly or protected by a locked ancestor. |
no test coverage detected