2018-07-18 12:03:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-13 11:20:04 -04:00
|
|
|
module Search
|
|
|
|
class GroupService < Search::GlobalService
|
|
|
|
attr_accessor :group
|
|
|
|
|
|
|
|
def initialize(user, group, params)
|
|
|
|
super(user, params)
|
|
|
|
|
2017-12-15 05:21:12 -05:00
|
|
|
@default_project_filter = false
|
2017-04-13 11:20:04 -04:00
|
|
|
@group = group
|
|
|
|
end
|
|
|
|
|
2018-08-15 09:25:17 -04:00
|
|
|
def execute
|
|
|
|
Gitlab::GroupSearchResults.new(
|
|
|
|
current_user, projects, group, params[:search], default_project_filter: default_project_filter
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2017-04-13 11:20:04 -04:00
|
|
|
def projects
|
|
|
|
return Project.none unless group
|
|
|
|
return @projects if defined? @projects
|
|
|
|
|
|
|
|
@projects = super.inside_path(group.full_path)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-09-13 09:26:31 -04:00
|
|
|
|
|
|
|
Search::GroupService.prepend_if_ee('EE::Search::GroupService')
|