Behave nicely when showing notifications not sent out to any contact

I noticed that there is no output shown for the history views in case no
contact has been notified, but time is short atm...

refs #9009
refs #9430
This commit is contained in:
Johannes Meyer 2015-06-16 13:32:35 +02:00
parent bf70ec2802
commit d5f7ee3c56
3 changed files with 7 additions and 2 deletions

View File

@ -31,6 +31,7 @@ if (count($history) === 0) {
case 'notify':
$icon = 'bell';
$title = $this->translate('Notification');
$msg = $msg ?: $this->translate('This notification was not sent out to any contact.');
break;
case 'comment':
$icon = 'comment';

View File

@ -52,6 +52,7 @@ if (count($notifications) === 0) {
<br>
<?php if (! $this->contact): ?>
<small>
<?php if ($notification->notification_contact_name): ?>
<?= sprintf(
$this->translate('Sent to %s'),
$this->qlink(
@ -60,6 +61,9 @@ if (count($notifications) === 0) {
array('contact_name' => $notification->notification_contact_name)
)
) ?>
<?php else: ?>
<?= $this->translate('This notification was not sent out to any contact.'); ?>
<?php endif ?>
</small>
<?php endif ?>
</td>

View File

@ -57,11 +57,11 @@ function contactsLink($match, $view) {
$title = $this->translate('Notification');
$stateClass = $isService ? Service::getStateText($event->state) : Host::getStateText($event->state);
$msg = preg_replace_callback(
$msg = $msg ? preg_replace_callback(
'/^\[([^\]]+)\]/',
function($match) use ($self) { return contactsLink($match, $self); },
$msg
);
) : $this->translate('This notification was not sent out to any contact.');
break;
case 'comment':
$icon = 'comment';