f1926b321d
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.
17 lines
411 B
Ruby
17 lines
411 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Explore::SnippetsController < Explore::ApplicationController
|
|
include PaginatedCollection
|
|
include Gitlab::NoteableMetadata
|
|
|
|
def index
|
|
@snippets = SnippetsFinder.new(current_user)
|
|
.execute
|
|
.page(params[:page])
|
|
.inc_author
|
|
|
|
return if redirect_out_of_range(@snippets)
|
|
|
|
@noteable_meta_data = noteable_meta_data(@snippets, 'Snippet')
|
|
end
|
|
end
|