gitlab-org--gitlab-foss/app/services/search/project_service.rb
Yorick Peterse ec349dc1b6 Refactor Gitlab::ProjectSearchResults
Previously this class would be given a project ID which was then used to
retrieve the corresponding Project object. However, in all cases the
Project object was already known as it was used to grab the ID to pass
to ProjectSearchResults. By just passing a Project instead we remove the
need for an extra query as well as the need for some other complexity
in this class.
2016-03-11 15:25:22 -05:00

15 lines
409 B
Ruby

module Search
class ProjectService
attr_accessor :project, :current_user, :params
def initialize(project, user, params)
@project, @current_user, @params = project, user, params.dup
end
def execute
Gitlab::ProjectSearchResults.new(project,
params[:search],
params[:repository_ref])
end
end
end