Skip to content

Commit

Permalink
Add clarifying comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Esteban Beltran committed May 18, 2022
1 parent 688536a commit 90ab499
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions x-pack/plugins/cases/public/common/use_cases_toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ function getAlertsCount(attachments: CaseAttachments): number {
let alertsCount = 0;
for (const attachment of attachments) {
if (attachment.type === CommentType.alert) {
// alertId might be an array
if (Array.isArray(attachment.alertId) && attachment.alertId.length > 1) {
alertsCount += attachment.alertId.length;
} else {
// or might be a single string
alertsCount++;
}

alertsCount++;
}
}
return alertsCount;
Expand Down

0 comments on commit 90ab499

Please sign in to comment.