Fix wrong unlock state when event is triggered

This commit is contained in:
GogoVega 2024-09-23 16:16:53 +02:00
parent a3c5b75368
commit 32540dd0e6
No known key found for this signature in database
GPG Key ID: E1E048B63AC5AC2B

View File

@ -589,6 +589,7 @@ RED.deploy = (function() {
RED.notify('<p>' + RED._("deploy.successfulDeploy") + '</p>', "success");
}
const flowsToLock = new Set()
// Node's properties cannot be modified if its workspace is locked.
function ensureUnlocked(id) {
const flow = id && (RED.nodes.workspace(id) || RED.nodes.subflow(id) || null);
const isLocked = flow ? flow.locked : false;
@ -645,6 +646,9 @@ RED.deploy = (function() {
RED.nodes.eachSubflow(function (subflow) {
if (subflow.changed) {
subflow.changed = false;
if (flowsToLock.has(subflow)) {
subflow.locked = true;
}
RED.events.emit("subflows:change", subflow);
}
});
@ -653,9 +657,13 @@ RED.deploy = (function() {
ensureUnlocked(ws.z)
ws.changed = false;
delete ws.added
if (flowsToLock.has(ws)) {
ws.locked = true;
}
RED.events.emit("flows:change", ws)
}
});
// Ensures all workspaces/subflows to be locked have been locked.
flowsToLock.forEach(flow => {
flow.locked = true
})