Prevent bots from indexing date ranges with no incidents. Closes #624.

This commit is contained in:
James Brooks 2015-05-08 11:06:02 +01:00
parent 2c0e806ad6
commit 06b9bc2757
2 changed files with 5 additions and 0 deletions

View File

@ -108,6 +108,8 @@ class HomeController extends AbstractController
$componentGroups = ComponentGroup::whereIn('id', $usedComponentGroups)->get();
$ungroupedComponents = Component::where('group_id', 0)->orderBy('order')->orderBy('created_at')->get();
$canPageBackward = Incident::notScheduled()->where('created_at', '<', $startDate->format('Y-m-d'))->count() != 0;
return View::make('index', [
'componentGroups' => $componentGroups,
'ungroupedComponents' => $ungroupedComponents,
@ -118,6 +120,7 @@ class HomeController extends AbstractController
'pageTitle' => Setting::get('app_name'),
'aboutApp' => Markdown::convertToHtml(Setting::get('app_about')),
'canPageForward' => (bool) $today->gt($startDate),
'canPageBackward' => $canPageBackward,
'previousDate' => $startDate->copy()->subDays($daysToShow)->toDateString(),
'nextDate' => $startDate->copy()->addDays($daysToShow)->toDateString(),
]);

View File

@ -41,11 +41,13 @@
<nav>
<ul class="pager">
@if($canPageBackward)
<li class="previous">
<a href="{{ route('status-page') }}?start_date={{ $previousDate }}">
<span aria-hidden="true">&larr;</span> {{ trans('cachet.incidents.previous_week') }}
</a>
</li>
@endif
@if($canPageForward)
<li class="next">
<a href="{{ route('status-page') }}?start_date={{ $nextDate }}">