Welcome to mirror list, hosted at ThFree Co, Russian Federation.

global_service.rb « search « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0bcc50c81a7217f266191ea3a82cb080bee1d48d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Search
  class GlobalService
    attr_accessor :current_user, :params

    def initialize(user, params)
      @current_user, @params = user, params.dup
    end

    def execute
      group = Group.find_by(id: params[:group_id]) if params[:group_id].present?
      projects = ProjectsFinder.new.execute(current_user)
      projects = projects.where(namespace_id: group.id) if group
      project_ids = projects.pluck(:id)

      Gitlab::SearchResults.new(project_ids, params[:search])
    end
  end
end