Skip to content

Commit

Permalink
EventRuleListItem: Respect new deleted flag
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Jul 5, 2024
1 parent 854ea3b commit 17f8590
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions library/Notifications/Widget/ItemList/EventRuleListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Icinga\Module\Notifications\Widget\RuleEscalationRecipientBadge;
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html;
use ipl\Stdlib\Filter;
use ipl\Web\Common\BaseListItem;
use ipl\Web\Widget\Icon;
use ipl\Web\Widget\Link;
Expand Down Expand Up @@ -38,7 +39,7 @@ protected function assembleFooter(BaseHtmlElement $footer): void
$meta->add(Html::tag('span', new Icon('filter')));
}

$escalationCount = $this->item->rule_escalation->count();
$escalationCount = $this->item->rule_escalation->filter(Filter::equal('deleted', 'n'))->count();
if ($escalationCount > 1) {
$meta->add(Html::tag('span', [new Icon('code-branch'), $escalationCount]));
}
Expand All @@ -55,12 +56,13 @@ protected function assembleHeader(BaseHtmlElement $header): void
{
$header->add($this->createTitle());
//TODO(sd): need fixes?
$rs = $this->item->rule_escalation->first();
$rs = $this->item->rule_escalation->filter(Filter::equal('deleted', 'n'))->first();
if ($rs) {
$recipientCount = $rs->rule_escalation_recipient->count();
$recipients = $rs->rule_escalation_recipient->filter(Filter::equal('deleted', 'n'));
$recipientCount = $recipients->count();
if ($recipientCount) {
$header->add(new RuleEscalationRecipientBadge(
$rs->rule_escalation_recipient->first(),
$recipients->first(),
$recipientCount - 1
));
}
Expand Down

0 comments on commit 17f8590

Please sign in to comment.