Compare commits

...

6 Commits
v1.2.0 ... 1.2

Author SHA1 Message Date
Graham Campbell
2311d67624 Updated dependencies 2015-09-04 15:01:16 +01:00
Graham Campbell
715d65f464 Laravel fixes 2015-09-04 14:44:48 +01:00
Graham Campbell
1ac4b7a64a Updated dependencies 2015-09-04 11:45:44 +01:00
Graham Campbell
941809037a Lock on laravel 5.1.12 2015-09-04 11:33:14 +01:00
Graham Campbell
0b8ce37e84 Merge pull request #935 from cachethq/fix-scheduled-items-timeline
Fixes #934 - Scheduled items now drop into the right days
2015-09-04 11:11:51 +01:00
James Brooks
0851427f2d Fixes #934 - Scheduled items now drop into the right days 2015-09-04 08:18:10 +01:00
6 changed files with 77 additions and 44 deletions

View File

@@ -65,7 +65,13 @@ class HomeController extends AbstractController
$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();
});

View File

@@ -141,7 +141,7 @@ class Incident extends Model implements HasPresenter
*/
public function getIsScheduledAttribute()
{
return $this->getOriginal('scheduled_at');
return $this->getOriginal('scheduled_at') !== null;
}
/**

View File

@@ -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.
*

View File

@@ -20,7 +20,7 @@
],
"require": {
"php": "^5.5.9",
"laravel/framework": "~5.1.10",
"laravel/framework": "~5.1.16",
"alt-three/emoji": "^1.2",
"barryvdh/laravel-cors": "^0.5",
"doctrine/dbal": "^2.5",

78
composer.lock generated
View File

@@ -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": "8ad05f265a7f13a963a021a55b21f451",
"hash": "90090fbbbdb825dab65c6b5278b77aba",
"packages": [
{
"name": "alt-three/emoji",
@@ -305,16 +305,16 @@
},
{
"name": "doctrine/annotations",
"version": "v1.2.6",
"version": "v1.2.7",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "f4a91702ca3cd2e568c3736aa031ed00c3752af4"
"reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/f4a91702ca3cd2e568c3736aa031ed00c3752af4",
"reference": "f4a91702ca3cd2e568c3736aa031ed00c3752af4",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535",
"reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535",
"shasum": ""
},
"require": {
@@ -369,20 +369,20 @@
"docblock",
"parser"
],
"time": "2015-06-17 12:21:22"
"time": "2015-08-31 12:32:49"
},
{
"name": "doctrine/cache",
"version": "v1.4.1",
"version": "v1.4.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "c9eadeb743ac6199f7eec423cb9426bc518b7b03"
"reference": "8c434000f420ade76a07c64cbe08ca47e5c101ca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/c9eadeb743ac6199f7eec423cb9426bc518b7b03",
"reference": "c9eadeb743ac6199f7eec423cb9426bc518b7b03",
"url": "https://api.github.com/repos/doctrine/cache/zipball/8c434000f420ade76a07c64cbe08ca47e5c101ca",
"reference": "8c434000f420ade76a07c64cbe08ca47e5c101ca",
"shasum": ""
},
"require": {
@@ -439,7 +439,7 @@
"cache",
"caching"
],
"time": "2015-04-15 00:11:59"
"time": "2015-08-31 12:36:41"
},
{
"name": "doctrine/collections",
@@ -509,16 +509,16 @@
},
{
"name": "doctrine/common",
"version": "v2.5.0",
"version": "v2.5.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/common.git",
"reference": "cd8daf2501e10c63dced7b8b9b905844316ae9d3"
"reference": "0009b8f0d4a917aabc971fb089eba80e872f83f9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/common/zipball/cd8daf2501e10c63dced7b8b9b905844316ae9d3",
"reference": "cd8daf2501e10c63dced7b8b9b905844316ae9d3",
"url": "https://api.github.com/repos/doctrine/common/zipball/0009b8f0d4a917aabc971fb089eba80e872f83f9",
"reference": "0009b8f0d4a917aabc971fb089eba80e872f83f9",
"shasum": ""
},
"require": {
@@ -578,7 +578,7 @@
"persistence",
"spl"
],
"time": "2015-04-02 19:55:44"
"time": "2015-08-31 13:00:22"
},
{
"name": "doctrine/dbal",
@@ -1544,7 +1544,7 @@
"name": "Jeremy Lindblom",
"email": "jeremeamia@gmail.com",
"homepage": "https://github.com/jeremeamia",
"role": "developer"
"role": "Developer"
}
],
"description": "Serialize Closure objects, including their context and binding",
@@ -1562,16 +1562,16 @@
},
{
"name": "laravel/framework",
"version": "v5.1.10",
"version": "v5.1.16",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "d47ccc8de10ccb6f328cc90f901ca5e47e077c93"
"reference": "e34dcc0c57e0f560248aec5128161256ff8bf4e1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/d47ccc8de10ccb6f328cc90f901ca5e47e077c93",
"reference": "d47ccc8de10ccb6f328cc90f901ca5e47e077c93",
"url": "https://api.github.com/repos/laravel/framework/zipball/e34dcc0c57e0f560248aec5128161256ff8bf4e1",
"reference": "e34dcc0c57e0f560248aec5128161256ff8bf4e1",
"shasum": ""
},
"require": {
@@ -1686,7 +1686,7 @@
"framework",
"laravel"
],
"time": "2015-08-12 18:16:08"
"time": "2015-09-04 12:46:14"
},
{
"name": "league/commonmark",
@@ -1893,16 +1893,16 @@
},
{
"name": "monolog/monolog",
"version": "1.16.0",
"version": "1.17.1",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "c0c0b4bee3aabce7182876b0d912ef2595563db7"
"reference": "0524c87587ab85bc4c2d6f5b41253ccb930a5422"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/c0c0b4bee3aabce7182876b0d912ef2595563db7",
"reference": "c0c0b4bee3aabce7182876b0d912ef2595563db7",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/0524c87587ab85bc4c2d6f5b41253ccb930a5422",
"reference": "0524c87587ab85bc4c2d6f5b41253ccb930a5422",
"shasum": ""
},
"require": {
@@ -1919,7 +1919,7 @@
"php-console/php-console": "^3.1.3",
"phpunit/phpunit": "~4.5",
"phpunit/phpunit-mock-objects": "2.3.0",
"raven/raven": "~0.8",
"raven/raven": "~0.11",
"ruflin/elastica": ">=0.90 <3.0",
"swiftmailer/swiftmailer": "~5.3",
"videlalvaro/php-amqplib": "~2.4"
@@ -1965,7 +1965,7 @@
"logging",
"psr-3"
],
"time": "2015-08-09 17:44:44"
"time": "2015-08-31 09:17:37"
},
{
"name": "mtdowling/cron-expression",
@@ -3791,16 +3791,16 @@
},
{
"name": "phpunit/phpunit",
"version": "4.8.4",
"version": "4.8.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "55bf1d6092b0e13a1f26bd5eaffeef3d8ad85ea7"
"reference": "2246830f4a1a551c67933e4171bf2126dc29d357"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/55bf1d6092b0e13a1f26bd5eaffeef3d8ad85ea7",
"reference": "55bf1d6092b0e13a1f26bd5eaffeef3d8ad85ea7",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2246830f4a1a551c67933e4171bf2126dc29d357",
"reference": "2246830f4a1a551c67933e4171bf2126dc29d357",
"shasum": ""
},
"require": {
@@ -3859,24 +3859,24 @@
"testing",
"xunit"
],
"time": "2015-08-15 04:21:23"
"time": "2015-08-24 04:09:38"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "2.3.6",
"version": "2.3.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42"
"reference": "5e2645ad49d196e020b85598d7c97e482725786a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/18dfbcb81d05e2296c0bcddd4db96cade75e6f42",
"reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5e2645ad49d196e020b85598d7c97e482725786a",
"reference": "5e2645ad49d196e020b85598d7c97e482725786a",
"shasum": ""
},
"require": {
"doctrine/instantiator": "~1.0,>=1.0.2",
"doctrine/instantiator": "^1.0.2",
"php": ">=5.3.3",
"phpunit/php-text-template": "~1.2",
"sebastian/exporter": "~1.2"
@@ -3915,7 +3915,7 @@
"mock",
"xunit"
],
"time": "2015-07-10 06:54:24"
"time": "2015-08-19 09:14:08"
},
{
"name": "sebastian/comparator",

View File

@@ -21,8 +21,7 @@
<strong>{{ $incident->name }}</strong>{{ $incident->isScheduled ? trans("cachet.incidents.scheduled_at", ["timestamp" => $incident->scheduled_at_diff]) : null }}
<br>
<small class="date">
<abbr class="timeago" data-toggle="tooltip" data-placement="right" title="{{ $incident->created_at_formatted }}" data-timeago="{{ $incident->created_at_iso }}">
</abbr>
<abbr class="timeago" data-toggle="tooltip" data-placement="right" title="{{ $incident->timestamp_formatted }}" data-timeago="{{ $incident->timestamp_iso }}"></abbr>
</small>
</div>
<div class="panel-body">