Skip to content

Commit 64355c3

Browse files
Fix issue with enable/disable
1 parent 06677d4 commit 64355c3

File tree

1 file changed

+8
-2
lines changed
  • x-pack/legacy/plugins/siem/server/lib/detection_engine/rules

1 file changed

+8
-2
lines changed

x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/update_rules.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import { defaults, pickBy, isEmpty } from 'lodash/fp';
8+
import { PartialAlert } from '../../../../../alerting/server/types';
89
import { readRules } from './read_rules';
910
import { UpdateRuleParams, IRuleSavedAttributesSavedObjectAttributes } from './types';
1011
import { addTags } from './add_tags';
@@ -108,7 +109,7 @@ export const updateRules = async ({
108109
type,
109110
references,
110111
version,
111-
}: UpdateRuleParams) => {
112+
}: UpdateRuleParams): Promise<PartialAlert | null> => {
112113
const rule = await readRules({ alertsClient, ruleId, id });
113114
if (rule == null) {
114115
return null;
@@ -206,5 +207,10 @@ export const updateRules = async ({
206207
} else {
207208
// enabled is null or undefined and we do not touch the rule
208209
}
209-
return update;
210+
211+
if (enabled != null) {
212+
return { ...update, enabled };
213+
} else {
214+
return update;
215+
}
210216
};

0 commit comments

Comments
 (0)