diff --git a/app/Http/Controllers/StatusPageController.php b/app/Http/Controllers/StatusPageController.php
index ac52d4e6..231b234d 100644
--- a/app/Http/Controllers/StatusPageController.php
+++ b/app/Http/Controllers/StatusPageController.php
@@ -62,7 +62,13 @@ class StatusPageController extends Controller
$allIncidents = Incident::notScheduled()->where('visible', '>=', $incidentVisiblity)->whereBetween('created_at', [
$startDate->copy()->subDays($daysToShow)->format('Y-m-d').' 00:00:00',
$startDate->format('Y-m-d').' 23:59:59',
- ])->orderBy('created_at', 'desc')->get()->groupBy(function (Incident $incident) use ($dateTimeZone) {
+ ])->orderBy('scheduled_at', 'desc')->orderBy('created_at', 'desc')->get()->groupBy(function (Incident $incident) use ($dateTimeZone) {
+ // If it's scheduled, get the scheduled at date.
+ if ($incident->is_scheduled) {
+ return (new Date($incident->scheduled_at))
+ ->setTimezone($dateTimeZone)->toDateString();
+ }
+
return (new Date($incident->created_at))
->setTimezone($dateTimeZone)->toDateString();
});
diff --git a/app/Models/Incident.php b/app/Models/Incident.php
index b8c0e042..8b32f59e 100644
--- a/app/Models/Incident.php
+++ b/app/Models/Incident.php
@@ -142,7 +142,7 @@ class Incident extends Model implements HasPresenter
*/
public function getIsScheduledAttribute()
{
- return $this->getOriginal('scheduled_at');
+ return $this->getOriginal('scheduled_at') !== null;
}
/**
diff --git a/app/Presenters/IncidentPresenter.php b/app/Presenters/IncidentPresenter.php
index 4241f5fb..d18cef4f 100644
--- a/app/Presenters/IncidentPresenter.php
+++ b/app/Presenters/IncidentPresenter.php
@@ -129,6 +129,34 @@ class IncidentPresenter extends AbstractPresenter
return $this->wrappedObject->scheduled_at->setTimezone($this->setting->get('app_timezone'))->format('d/m/Y H:i');
}
+ /**
+ * Returns a formatted timestamp for use within the timeline.
+ *
+ * @return string
+ */
+ public function timestamp_formatted()
+ {
+ if ($this->wrappedObject->is_scheduled) {
+ return $this->scheduled_at_formatted;
+ } else {
+ return $this->created_at_formatted;
+ }
+ }
+
+ /**
+ * Return the iso timestamp for use within the timeline.
+ *
+ * @return string
+ */
+ public function timestamp_iso()
+ {
+ if ($this->wrappedObject->is_scheduled) {
+ return $this->scheduled_at_iso;
+ } else {
+ return $this->created_at_iso;
+ }
+ }
+
/**
* Present the status with an icon.
*
diff --git a/composer.json b/composer.json
index 6c008a7a..194f7006 100644
--- a/composer.json
+++ b/composer.json
@@ -20,7 +20,7 @@
],
"require": {
"php": "^5.5.9",
- "laravel/framework": "~5.1.10",
+ "laravel/framework": "5.1.12",
"alt-three/emoji": "^1.2",
"alt-three/validator": "^1.2",
"barryvdh/laravel-cors": "^0.5",
diff --git a/composer.lock b/composer.lock
index c55a30fd..4341a6bc 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "70ca29984807ed324db890c91c3a1492",
+ "hash": "05f03078291036582d00ac77cb0c77e2",
"packages": [
{
"name": "alt-three/emoji",
diff --git a/resources/views/partials/incident.blade.php b/resources/views/partials/incident.blade.php
index 223301b8..9a9feda8 100644
--- a/resources/views/partials/incident.blade.php
+++ b/resources/views/partials/incident.blade.php
@@ -13,9 +13,9 @@
@if($with_link)
-
+
@else
-
+
@endif