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