debian-mirror-gitlab/app/services/search/global_service.rb

19 lines
509 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
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)
2015-04-26 12:48:37 +05:30
Gitlab::SearchResults.new(project_ids, params[:search])
2014-09-02 18:07:02 +05:30
end
end
end