Add incident column for when an incident occurred at (#2212)

Add incident column for when an incident occurred at. Closes #2208
[ci skip] [skip ci]
This commit is contained in:
James Brooks
2016-10-29 17:25:52 +01:00
committed by GitHub
parent 0e0a7d9db2
commit a0f2d6642e
26 changed files with 331 additions and 79 deletions

View File

@@ -18,6 +18,11 @@ use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Str;
/**
* This is the feed controller.
*
* @author James Brooks <james@alt-three.com>
*/
class FeedController extends Controller
{
/**
@@ -80,12 +85,12 @@ class FeedController extends Controller
{
if ($group->exists) {
$group->components->map(function ($component) use ($isRss) {
$component->incidents()->visible()->orderBy('created_at', 'desc')->get()->map(function ($incident) use ($isRss) {
$component->incidents()->visible()->orderBy('occurred_at', 'desc')->get()->map(function ($incident) use ($isRss) {
$this->feedAddItem($incident, $isRss);
});
});
} else {
Incident::visible()->orderBy('created_at', 'desc')->get()->map(function ($incident) use ($isRss) {
Incident::visible()->orderBy('occurred_at', 'desc')->get()->map(function ($incident) use ($isRss) {
$this->feedAddItem($incident, $isRss);
});
}
@@ -105,7 +110,7 @@ class FeedController extends Controller
$incident->name,
Config::get('setting.app_name'),
Str::canonicalize(cachet_route('incident', [$incident->id])),
$isRss ? $incident->created_at->toRssString() : $incident->created_at->toAtomString(),
$isRss ? $incident->occurred_at->toRssString() : $incident->occurred_at->toAtomString(),
$isRss ? $incident->message : Markdown::convertToHtml($incident->message)
);
}