summaryrefslogtreecommitdiff
path: root/app/controllers/dashboard/snippets_controller.rb
blob: a8ca3dbd0e7ac4238793fde787d56b1aa863e627 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

class Dashboard::SnippetsController < Dashboard::ApplicationController
  include PaginatedCollection
  include Gitlab::NoteableMetadata
  include SnippetsSort

  skip_cross_project_access_check :index

  def index
    @snippet_counts = Snippets::CountService
      .new(current_user, author: current_user)
      .execute

    @snippets = SnippetsFinder.new(current_user, author: current_user, scope: params[:scope], sort: sort_param)
      .execute
      .page(params[:page])
      .inc_author

    return if redirect_out_of_range(@snippets)

    @noteable_meta_data = noteable_meta_data(@snippets, 'Snippet')
  end
end