Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Feb 18, 2021
1 parent c77ae9c commit 70075bd
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions x-pack/plugins/case/server/client/cases/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,21 @@ export const createIncident = async ({
}, 0) ?? 0;

let comments: ExternalServiceComment[] = [];

if (commentsToBeUpdated && Array.isArray(commentsToBeUpdated) && commentsToBeUpdated.length > 0) {
const commentsMapping = mappings.find((m) => m.source === 'comments');
if (commentsMapping?.action_type !== 'nothing') {
comments = transformComments(commentsToBeUpdated, ['informationAdded']);
if (totalAlerts > 0) {
comments.push({
comment: `Elastic Security Alerts attached to the case: ${totalAlerts}`,
commentId: '',
});
}
}
}

if (totalAlerts > 0) {
comments.push({
comment: `Elastic Security Alerts attached to the case: ${totalAlerts}`,
commentId: '',
});
}

return { incident, comments };
};

Expand Down

0 comments on commit 70075bd

Please sign in to comment.