gitlab-org--gitlab-foss/app/services/search/global_service.rb

22 lines
534 B
Ruby
Raw Normal View History

module Search
class GlobalService
attr_accessor :current_user, :params
def initialize(user, params)
@current_user, @params = user, params.dup
end
def execute
2014-01-19 13:55:59 -05:00
group = Group.find_by(id: params[:group_id]) if params[:group_id].present?
projects = ProjectsFinder.new.execute(current_user)
if group
ids = group.descendants.push(group.id)
projects = projects.in_namespace(ids)
end
Gitlab::SearchResults.new(current_user, projects, params[:search])
end
end
end