Skip to content

Commit

Permalink
IncidentListItem: Do not render object names as anchor if `$noSubject…
Browse files Browse the repository at this point in the history
…Link` property is set
  • Loading branch information
raviks789 authored and nilmerg committed Sep 19, 2023
1 parent 19fa458 commit 0f0628b
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions library/Notifications/Widget/ItemList/IncidentListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,27 @@ protected function assembleVisual(BaseHtmlElement $visual): void
protected function assembleTitle(BaseHtmlElement $title): void
{
$title->addHtml(Html::tag('span', [], sprintf('#%d:', $this->item->id)));
$subject = $this->item->object->service ?? $this->item->object->host;
if (! $this->list->getNoSubjectLink()) {
$content = new Link(
$subject,
Links::incident($this->item->id),
['class' => 'subject']
);
} else {
$content = Html::tag(
'span',
['class' => 'subject'],
$subject
);
}

if ($this->item->object->service) {
$content = Html::sprintf(
t('%s on %s', '<service> on <host>'),
new Link(
$this->item->object->service,
Links::incident($this->item->id),
['class' => 'subject']
),
$content,
Html::tag('span', ['class' => 'subject'], $this->item->object->host)
);
} else {
$content = new Link(
$this->item->object->host,
Links::incident($this->item->id),
['class' => 'subject']
);
}

$title->addHtml($content);
Expand Down

0 comments on commit 0f0628b

Please sign in to comment.