Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Koller <mkoller@gitlab.com>2019-09-03 20:45:00 +0300
committerMarkus Koller <mkoller@gitlab.com>2019-09-10 16:24:29 +0300
commitf1926b321deb8b922dead991fb4d8bea42699f9f (patch)
tree7dfb7b613152cc6282b1f169e781f11f736de36a /app/controllers/snippets_controller.rb
parent60755fbc406bd25ab526339899f97a2b27aeb272 (diff)
Add controller concern for paginated collections
We had similar code in a few places to redirect to the last page if the given page number is out of range. This unifies the handling in a new controller concern and adds usage of it in all snippet listings.
Diffstat (limited to 'app/controllers/snippets_controller.rb')
-rw-r--r--app/controllers/snippets_controller.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index c1e05b72b37..5805d068e21 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -7,6 +7,7 @@ class SnippetsController < ApplicationController
include SnippetsActions
include RendersBlob
include PreviewMarkdown
+ include PaginatedCollection
include Gitlab::NoteableMetadata
skip_before_action :verify_authenticity_token,
@@ -37,6 +38,8 @@ class SnippetsController < ApplicationController
.page(params[:page])
.inc_author
+ return if redirect_out_of_range(@snippets)
+
@noteable_meta_data = noteable_meta_data(@snippets, 'Snippet')
render 'index'