mirror of https://github.com/node-red/node-red.git
Apply suggestions from code review
Co-authored-by: Gauthier Dandele <92022724+GogoVega@users.noreply.github.com>pull/4975/head
parent
4e61c54be5
commit
66bd1feb47
|
@ -492,8 +492,14 @@ RED.history = (function() {
|
|||
});
|
||||
}
|
||||
if (i === "credentials" && ev.changes[i]) {
|
||||
// Reset - Only want to keep the changes
|
||||
inverseEv.changes[i] = {};
|
||||
for (const [key, value] of Object.entries(ev.changes[i])) {
|
||||
inverseEv.changes[i][key] = ev.node.credentials[key];
|
||||
ev.node.credentials[key] = value;
|
||||
if (ev.node._def.credentials[key]?.type === 'password') {
|
||||
ev.node.credentials['has_' + key] = !!value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ev.node[i] = ev.changes[i];
|
||||
|
|
|
@ -855,6 +855,12 @@ RED.editor = (function() {
|
|||
for (const prop in editing_node._def.credentials) {
|
||||
if (Object.prototype.hasOwnProperty.call(editing_node._def.credentials, prop)) {
|
||||
if (oldCreds[prop] !== editing_node.credentials[prop]) {
|
||||
if (editing_node.credentials[prop] === '__PWRD__') {
|
||||
// The password may not exist in oldCreds
|
||||
// The value '__PWRD__' means the password exists,
|
||||
// so ignore this change
|
||||
continue;
|
||||
}
|
||||
editState.changes.credentials = editState.changes.credentials || {};
|
||||
editState.changes.credentials[prop] = oldCreds[prop];
|
||||
editState.changed = true;
|
||||
|
|
Loading…
Reference in New Issue