Skip to content

Commit

Permalink
IncidentDetail: Use relation incindent.object instead of `event.obj…
Browse files Browse the repository at this point in the history
…ect`

Since the `event` can be null, object should be fetched using incident relation.
  • Loading branch information
sukhwinder33445 authored and nilmerg committed May 3, 2024
1 parent 7c602fc commit 3224f65
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions library/Notifications/Widget/Detail/IncidentDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ protected function createHistory()
$history = $this->incident->incident_history
->with([
'event',
'event.object',
'event.object.source',
'incident.object',
'incident.object.source',
'contact',
'rule',
'rule_escalation',
Expand All @@ -107,7 +107,7 @@ protected function createHistory()
]);

$history
->withColumns('event.object.id_tags')
->withColumns('incident.object.id_tags')
->on(Query::ON_SELECT_ASSEMBLED, function (Select $select) use ($history) {
Database::registerGroupBy($history, $select);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function assembleTitle(BaseHtmlElement $title): void
->set('data-action-item', true);

/** @var Objects $obj */
$obj = $this->item->event->object;
$obj = $this->item->incident->object;
$content = new Link($obj->getName(), Links::event($this->item->event_id), ['class' => 'subject']);

$title->addHtml($content);
Expand All @@ -78,7 +78,7 @@ protected function assembleHeader(BaseHtmlElement $header): void
$header->addHtml($this->createCaption());
if ($this->item->type === 'opened' || $this->item->type === 'incident_severity_changed') {
$header->add(
(new SourceIcon(SourceIcon::SIZE_BIG))->addHtml($this->item->event->object->source->getIcon())
(new SourceIcon(SourceIcon::SIZE_BIG))->addHtml($this->item->incident->object->source->getIcon())
);
}

Expand Down

0 comments on commit 3224f65

Please sign in to comment.