Skip to content

Commit cc6c8c5

Browse files
committed
lock behavior
1 parent eb636a7 commit cc6c8c5

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const ACTION_LABELS: Record<NotificationAction['type'], string> = {
2626
} as const
2727

2828
function isAutoDismissable(n: Notification): boolean {
29-
return !!n.workflowId
29+
return !!n.workflowId && n.action?.type !== 'unlock-workflow'
3030
}
3131

3232
function NotificationCountdownRing({ onPause }: { onPause: () => void }) {
@@ -99,7 +99,7 @@ export const Notifications = memo(function Notifications({ embedded }: Notificat
9999
break
100100
case 'unlock-workflow':
101101
window.dispatchEvent(new CustomEvent('unlock-workflow'))
102-
break
102+
return
103103
default:
104104
logger.warn('Unknown action type', { notificationId, actionType: action.type })
105105
}

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ const WorkflowContent = React.memo(
12741274
if (workflowReadOnly) {
12751275
if (lockNotificationIdRef.current) return
12761276

1277-
const isAdmin = effectivePermissions.canAdmin
1277+
const isAdmin = workspacePermissions?.viewer?.isAdmin ?? effectivePermissions.canAdmin
12781278
const isFolderInherited = workflowFolderLocked && !workflowRowLocked
12791279
const message = isFolderInherited
12801280
? inheritedLockFolderName
@@ -1304,6 +1304,7 @@ const WorkflowContent = React.memo(
13041304
inheritedLockFolderName,
13051305
isWorkflowReady,
13061306
effectivePermissions.canAdmin,
1307+
workspacePermissions,
13071308
addNotification,
13081309
activeWorkflowId,
13091310
clearLockNotification,
@@ -4176,7 +4177,7 @@ const WorkflowContent = React.memo(
41764177
edges.filter((e) => e.target === contextMenuBlocks[0]?.id).length === 0
41774178
}
41784179
onToggleLocked={handleContextToggleLocked}
4179-
canAdmin={effectivePermissions.canAdmin}
4180+
canAdmin={effectivePermissions.canAdmin && !workflowReadOnly}
41804181
/>
41814182

41824183
<CanvasMenu
@@ -4202,7 +4203,7 @@ const WorkflowContent = React.memo(
42024203
hasLockedBlocks={hasLockedBlocks}
42034204
onToggleWorkflowLock={handleToggleWorkflowLock}
42044205
allBlocksLocked={allBlocksLocked}
4205-
canAdmin={effectivePermissions.canAdmin}
4206+
canAdmin={effectivePermissions.canAdmin && !workflowReadOnly}
42064207
hasBlocks={hasBlocks}
42074208
/>
42084209
</>

0 commit comments

Comments
 (0)