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

18 lines
473 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)
2015-09-11 14:41:01 +05:30
projects = projects.in_namespace(group.id) if group
2014-09-02 18:07:02 +05:30
2016-06-02 11:05:42 +05:30
Gitlab::SearchResults.new(current_user, projects, params[:search])
2014-09-02 18:07:02 +05:30
end
end
end