Skip to content

Commit 7c89917

Browse files
do it for each type of received item.
1 parent 6dcb159 commit 7c89917

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Modules/CIPPCore/Public/New-CIPPAlertTemplate.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ function New-CIPPAlertTemplate {
2121
$RuleTable = ''
2222
$Table = ''
2323
$LocationInfo = $LocationInfo ?? $Data.CIPPLocationInfo | ConvertFrom-Json -ErrorAction SilentlyContinue | Select-Object * -ExcludeProperty Etag, PartitionKey, TimeStamp
24+
if ($Data -is [string]) {
25+
$Data = @{ message = $Data }
26+
}
27+
if ($Data -is [array] -and $Data[0] -is [string]) {
28+
$Data = $Data | ForEach-Object { @{ message = $_ } }
29+
}
2430
if ($InputObject -eq 'table') {
2531
#data can be a array of strings or a string, if it is, we need to convert it to an object so it shows up nicely, that object will have one header: message.
26-
if ($Data -is [string]) {
27-
$Data = @{ message = $Data }
28-
}
29-
if ($Data -is [array] -and $Data[0] -is [string]) {
30-
$Data = $Data | ForEach-Object { @{ message = $_ } }
31-
}
32+
3233
$DataHTML = ($Data | Select-Object * -ExcludeProperty Etag, PartitionKey, TimeStamp | ConvertTo-Html | Out-String).Replace('<table>', ' <table class="table-modern">')
3334
$IntroText = "<p>You've configured CIPP to send you alerts based on the logbook. The following alerts match your configured rules</p>$dataHTML"
3435
$ButtonUrl = "$CIPPURL/cipp/logs"

0 commit comments

Comments
 (0)