diff options
author | Markus Koller <mkoller@gitlab.com> | 2019-09-03 20:45:00 +0300 |
---|---|---|
committer | Markus Koller <mkoller@gitlab.com> | 2019-09-10 16:24:29 +0300 |
commit | f1926b321deb8b922dead991fb4d8bea42699f9f (patch) | |
tree | 7dfb7b613152cc6282b1f169e781f11f736de36a /app/controllers/explore | |
parent | 60755fbc406bd25ab526339899f97a2b27aeb272 (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/explore')
-rw-r--r-- | app/controllers/explore/snippets_controller.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/controllers/explore/snippets_controller.rb b/app/controllers/explore/snippets_controller.rb index 6192b594593..d4c6aae2ca8 100644 --- a/app/controllers/explore/snippets_controller.rb +++ b/app/controllers/explore/snippets_controller.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class Explore::SnippetsController < Explore::ApplicationController + include PaginatedCollection include Gitlab::NoteableMetadata def index @@ -9,6 +10,8 @@ class Explore::SnippetsController < Explore::ApplicationController .page(params[:page]) .inc_author + return if redirect_out_of_range(@snippets) + @noteable_meta_data = noteable_meta_data(@snippets, 'Snippet') end end |