mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-01-17 21:49:01 +01:00
Prevent bots from indexing date ranges with no incidents. Closes #624.
This commit is contained in:
parent
2c0e806ad6
commit
06b9bc2757
@ -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(),
|
||||
]);
|
||||
|
@ -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">←</span> {{ trans('cachet.incidents.previous_week') }}
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
@if($canPageForward)
|
||||
<li class="next">
|
||||
<a href="{{ route('status-page') }}?start_date={{ $nextDate }}">
|
||||
|
Loading…
x
Reference in New Issue
Block a user