From 13ccfdd920ef890027a486ec0fa8b429cfce17d6 Mon Sep 17 00:00:00 2001 From: Davis Plumlee Date: Thu, 9 Feb 2023 13:21:31 -0500 Subject: [PATCH 1/2] strips out comments --- .../rule_exceptions/utils/helpers.test.tsx | 7 +++++++ .../detection_engine/rule_exceptions/utils/helpers.tsx | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.test.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.test.tsx index d3875415c49c7..26aacfbc1ea86 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.test.tsx @@ -384,6 +384,13 @@ describe('Exception helpers', () => { const result = prepareExceptionItemsForBulkClose(payload); expect(result).toEqual(expected); }); + + test("should strip out any comments in the exceptions for bulk close'", () => { + const exceptionItemWithComment = {...getExceptionListItemSchemaMock(), comments: getCommentsArrayMock()} + const payload = [exceptionItemWithComment]; + const result = prepareExceptionItemsForBulkClose(payload); + expect(result).toEqual([getExceptionListItemSchemaMock()]); + }); }); describe('#lowercaseHashValues', () => { diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.tsx index 6a739fd34a05a..1725a51a4225a 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.tsx @@ -154,9 +154,10 @@ export const prepareExceptionItemsForBulkClose = ( return { ...item, entries: newEntries, + comments: [], // Strips out unneeded comments attribute for bulk close as they are not needed and are throwing type errors }; } else { - return item; + return {...item, comments: []}; } }); }; From 3b9dcc8535093e89e23cb2d805d47cdf159e3549 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 9 Feb 2023 18:44:41 +0000 Subject: [PATCH 2/2] [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' --- .../detection_engine/rule_exceptions/utils/helpers.test.tsx | 5 ++++- .../detection_engine/rule_exceptions/utils/helpers.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.test.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.test.tsx index 26aacfbc1ea86..97a6a00c9cf0a 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.test.tsx @@ -386,7 +386,10 @@ describe('Exception helpers', () => { }); test("should strip out any comments in the exceptions for bulk close'", () => { - const exceptionItemWithComment = {...getExceptionListItemSchemaMock(), comments: getCommentsArrayMock()} + const exceptionItemWithComment = { + ...getExceptionListItemSchemaMock(), + comments: getCommentsArrayMock(), + }; const payload = [exceptionItemWithComment]; const result = prepareExceptionItemsForBulkClose(payload); expect(result).toEqual([getExceptionListItemSchemaMock()]); diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.tsx index 1725a51a4225a..aaaffb0e70d2c 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.tsx @@ -157,7 +157,7 @@ export const prepareExceptionItemsForBulkClose = ( comments: [], // Strips out unneeded comments attribute for bulk close as they are not needed and are throwing type errors }; } else { - return {...item, comments: []}; + return { ...item, comments: [] }; } }); };