2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
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
|
2016-06-02 11:05:42 +05:30
|
|
|
Gitlab::ProjectSearchResults.new(current_user,
|
|
|
|
project,
|
2015-04-26 12:48:37 +05:30
|
|
|
params[:search],
|
|
|
|
params[:repository_ref])
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
def scope
|
|
|
|
@scope ||= %w[notes issues merge_requests milestones wiki_blobs commits].delete(params[:scope]) { 'blobs' }
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|