[editor] Fix non-optional booleans causing rules to be non-saveable

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-02-04 14:17:48 +01:00
parent 897b97a833
commit bd9bddc9b1
Signed by: luzifer
GPG Key ID: D91C3E91E4CAD6F5

View File

@ -1015,7 +1015,7 @@ export default {
// Check for zero-values and drop the field on zero-value
switch (field.type) {
case 'bool':
if (att[1] === false) {
if (att[1] === false && field.optional) {
return false
}
break
@ -1109,7 +1109,7 @@ export default {
switch (field.type) {
case 'bool':
if (!field.optional && !action.attributes[field.key]) {
if (!field.optional && typeof action.attributes[field.key] !== 'boolean') {
return false
}
break
@ -1222,7 +1222,7 @@ export default {
}
for (const field of def.fields) {
if (!field.optional && !action.attributes[field.key]) {
if (!field.optional && action.attributes[field.key] === undefined) {
this.validateReason = `${action.type} -> ${field.key} -> opt`
return false
}