2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-09-25 12:07:36 +05:30
|
|
|
class Dashboard::SnippetsController < Dashboard::ApplicationController
|
2019-12-04 20:38:33 +05:30
|
|
|
include PaginatedCollection
|
|
|
|
include Gitlab::NoteableMetadata
|
2020-07-28 23:09:34 +05:30
|
|
|
include SnippetsSort
|
2019-12-04 20:38:33 +05:30
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
skip_cross_project_access_check :index
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
feature_category :snippets
|
|
|
|
|
2015-09-25 12:07:36 +05:30
|
|
|
def index
|
2020-03-13 15:44:24 +05:30
|
|
|
@snippet_counts = Snippets::CountService
|
|
|
|
.new(current_user, author: current_user)
|
|
|
|
.execute
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
@snippets = SnippetsFinder.new(current_user, author: current_user, scope: params[:scope], sort: sort_param)
|
2019-12-04 20:38:33 +05:30
|
|
|
.execute
|
|
|
|
.page(params[:page])
|
|
|
|
.inc_author
|
2021-03-08 18:12:59 +05:30
|
|
|
.inc_projects_namespace_route
|
2021-04-17 20:07:23 +05:30
|
|
|
.inc_statistics
|
2019-12-04 20:38:33 +05:30
|
|
|
|
|
|
|
return if redirect_out_of_range(@snippets)
|
|
|
|
|
|
|
|
@noteable_meta_data = noteable_meta_data(@snippets, 'Snippet')
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
end
|