Display downtime end even if it hasn't been started yet

resolves #12764
This commit is contained in:
Eric Lippmann 2016-12-09 13:47:21 +01:00
parent 665557be27
commit 2292010a15
2 changed files with 17 additions and 8 deletions

View File

@ -42,6 +42,9 @@
<?= $this->translate('by') ?>
<?= $this->escape($downtime->author_name) ?>
</span>
<?php if (! $downtime->is_in_effect && $downtime->start >= time()): ?>
<span><?= sprintf($this->translate('expires %s'), $this->timeUntil($downtime->end)) ?></span>
<?php endif ?>
<span class="comment-icons">
<?php if ($downtime->is_flexible): ?>
<?= $this->icon('magic', $this->translate('This downtime is flexible')); ?>

View File

@ -60,15 +60,21 @@ if (empty($object->comments) && ! $addLink) {
$this->translate('ends %s', 'Last format parameter represents the end time'),
$this->timeUntil($downtime->is_flexible ? $downtime->scheduled_end : $downtime->end)
);
} elseif ((bool) $downtime->is_fixed) {
$state = sprintf(
$this->translate('scheduled %s', 'Last format parameter represents the time scheduled'),
$this->timeUntil($downtime->start)
);
} else {
$state = sprintf(
$this->translate('scheduled flexible %s', 'Last format parameter represents the time scheduled'),
$this->timeUntil($downtime->start)
if ((bool) $downtime->is_fixed) {
$state = sprintf(
$this->translate('scheduled %s', 'Last format parameter represents the time scheduled'),
$this->timeUntil($downtime->start)
);
} else {
$state = sprintf(
$this->translate('scheduled flexible %s', 'Last format parameter represents the time scheduled'),
$this->timeUntil($downtime->start)
);
}
$state .= ' ' . sprintf(
$this->translate('expires %s', 'Last format parameter represents the downtime expire time'),
$this->timeUntil($downtime->end)
);
}
}