fix(automations): preserve actions when a delay resets invalid conditions

Enabling a delay on a rule with delay-unsafe conditions called onEventChange, which
resets conditions AND actions to defaults, silently replacing the user's configured
actions with assign_agent. Reset only the conditions (getDefaultConditions) and leave
the actions intact.
This commit is contained in:
Tanmay Deep Sharma
2026-07-15 23:26:44 +05:30
parent f4e0481b00
commit 2b8d1a67b3
@@ -11,6 +11,7 @@ import Dialog from 'dashboard/components-next/dialog/Dialog.vue';
import {
generateAutomationPayload,
getAttributes,
getDefaultConditions,
getFileName,
showActionInput,
} from 'dashboard/helper/automationHelper';
@@ -276,12 +277,14 @@ watch([isDelayed, delayInMinutes], () => {
: null;
});
// Turning on a delay narrows the condition options; reset conditions the delayed rule can't use
// (e.g. a mutable attribute) to the event default. Valid selections (incl. an edit) are kept.
// Turning on a delay narrows the condition options; reset only the conditions a delayed rule
// can't use (e.g. a mutable attribute) to the event default. Actions and valid selections are kept.
watch(isDelayed, delayed => {
if (!delayed || !automation.value) return;
if (!isDelaySupported.value) {
props.onEventChange();
automation.value.conditions = getDefaultConditions(
automation.value.event_name
);
}
});