Skip to content

Commit

Permalink
fix: OR button hiding and empty condtions (#3269)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheusLasserre authored Jan 11, 2024
1 parent 3aa2fd1 commit 0e28b6c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion frontend/web/components/modals/Rule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ export default class Rule extends PureComponent<{
rule: { conditions: rules },
},
} = this
const isLastRule = i === rules.length - 1
const lastIndex = rules.reduce((acc, v, i) => {
if (!v.delete) {
return i
}
return acc
}, 0)
const isLastRule = i === lastIndex
const hasOr = i > 0
const operatorObj = Utils.findOperator(rule.operator, rule.value, operators)
const operator = operatorObj && operatorObj.value
Expand Down Expand Up @@ -206,6 +212,11 @@ export default class Rule extends PureComponent<{
rules[i].value = ''
}

if (prop === 'delete') {
rules[i].property = 'deleted'
rules[i].value = 'deleted'
}

if (!rule.conditions.filter((condition) => !condition.delete).length) {
rule.delete = true
}
Expand Down

0 comments on commit 0e28b6c

Please sign in to comment.