2018-09-23 15:44:14 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-09-08 09:49:20 -04:00
|
|
|
class Dashboard::SnippetsController < Dashboard::ApplicationController
|
2019-09-03 13:45:00 -04:00
|
|
|
include PaginatedCollection
|
2019-09-02 07:12:20 -04:00
|
|
|
include Gitlab::NoteableMetadata
|
2020-07-10 14:09:45 -04:00
|
|
|
include SnippetsSort
|
2019-09-02 07:12:20 -04:00
|
|
|
|
2017-12-11 09:21:06 -05:00
|
|
|
skip_cross_project_access_check :index
|
|
|
|
|
2015-09-08 09:49:20 -04:00
|
|
|
def index
|
2020-02-05 04:08:43 -05:00
|
|
|
@snippet_counts = Snippets::CountService
|
|
|
|
.new(current_user, author: current_user)
|
|
|
|
.execute
|
|
|
|
|
2020-07-10 14:09:45 -04:00
|
|
|
@snippets = SnippetsFinder.new(current_user, author: current_user, scope: params[:scope], sort: sort_param)
|
2019-09-02 07:12:20 -04:00
|
|
|
.execute
|
|
|
|
.page(params[:page])
|
|
|
|
.inc_author
|
|
|
|
|
2019-09-03 13:45:00 -04:00
|
|
|
return if redirect_out_of_range(@snippets)
|
|
|
|
|
2019-09-02 07:12:20 -04:00
|
|
|
@noteable_meta_data = noteable_meta_data(@snippets, 'Snippet')
|
2015-09-08 09:49:20 -04:00
|
|
|
end
|
|
|
|
end
|