diff --git a/frontend/src/constants/filterConfig.js b/frontend/src/constants/filterConfig.js index 5c6098bb..5c994e1d 100644 --- a/frontend/src/constants/filterConfig.js +++ b/frontend/src/constants/filterConfig.js @@ -38,5 +38,5 @@ export const FIELD_OPERATORS = { OPERATOR.GREATER_THAN, OPERATOR.LESS_THAN ], - NUMBER: [OPERATOR.EQUALS, OPERATOR.NOT_EQUALS], + NUMBER: [OPERATOR.EQUALS, OPERATOR.NOT_EQUALS, OPERATOR.GREATER_THAN, OPERATOR.LESS_THAN], } diff --git a/frontend/src/features/admin/automation/RuleBox.vue b/frontend/src/features/admin/automation/RuleBox.vue index 6e5816cc..13b29f99 100644 --- a/frontend/src/features/admin/automation/RuleBox.vue +++ b/frontend/src/features/admin/automation/RuleBox.vue @@ -206,9 +206,7 @@ -
-
- +
@@ -380,6 +378,10 @@ const emitUpdate = () => { } const getFieldOperators = (field, fieldType) => { + // Set default field type if not set for backwards compatibility as this field was added later. + if (!fieldType) { + fieldType = fieldTypeConstants.conversation + } if (fieldType === fieldTypeConstants.contact_custom_attribute) { return contactCustomAttributes.value[field]?.operators || [] } @@ -390,6 +392,10 @@ const getFieldOperators = (field, fieldType) => { } const getFieldOptions = (field, fieldType) => { + // Set default field type if not set for backwards compatibility as this field was added later. + if (!fieldType) { + fieldType = fieldTypeConstants.conversation + } if (fieldType === fieldTypeConstants.contact_custom_attribute) { return contactCustomAttributes.value[field]?.options || [] } @@ -401,9 +407,14 @@ const getFieldOptions = (field, fieldType) => { const inputType = (index) => { const field = ruleGroup.value.rules[index]?.field - const fieldType = ruleGroup.value.rules[index]?.field_type const operator = ruleGroup.value.rules[index]?.operator + let fieldType = ruleGroup.value.rules[index]?.field_type if (['contains', 'not contains'].includes(operator)) return 'tag' + + // Set default field type if not set for backwards compatibility as this field was added later. + if (!fieldType) { + fieldType = fieldTypeConstants.conversation + } if (field && fieldType) { if (fieldType === fieldTypeConstants.contact_custom_attribute) { return contactCustomAttributes.value[field]?.type || '' diff --git a/internal/automation/evaluator.go b/internal/automation/evaluator.go index 1ca1825e..58774919 100644 --- a/internal/automation/evaluator.go +++ b/internal/automation/evaluator.go @@ -111,7 +111,7 @@ func (e *Engine) evaluateRule(rule models.RuleDetail, conversation cmodels.Conve customAttributes map[string]any ) - // Assign default field type if not provided + // Assign default field type if not provided for backward compatibility. if rule.FieldType == "" { rule.FieldType = models.FieldTypeConversationField }