gitlab-org--gitlab-foss/app/services/search/global_service.rb
Dmitriy Zaporozhets ba2d7eda61 Improve search within group logic
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2017-01-30 17:34:14 +02:00

20 lines
498 B
Ruby

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)
if group
projects = projects.inside_path(group.full_path)
end
Gitlab::SearchResults.new(current_user, projects, params[:search])
end
end
end