2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
module Search
|
|
|
|
class GroupService < Search::GlobalService
|
|
|
|
attr_accessor :group
|
|
|
|
|
|
|
|
def initialize(user, group, params)
|
|
|
|
super(user, params)
|
|
|
|
|
|
|
|
@group = group
|
|
|
|
end
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
def execute
|
|
|
|
Gitlab::GroupSearchResults.new(
|
2020-11-24 15:15:51 +05:30
|
|
|
current_user,
|
|
|
|
params[:search],
|
|
|
|
projects,
|
|
|
|
group: group,
|
2021-01-29 00:20:46 +05:30
|
|
|
order_by: params[:order_by],
|
2021-01-03 14:25:43 +05:30
|
|
|
sort: params[:sort],
|
|
|
|
filters: { state: params[:state], confidential: params[:confidential] }
|
2019-07-07 11:18:12 +05:30
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
def projects
|
|
|
|
return Project.none unless group
|
|
|
|
return @projects if defined? @projects
|
|
|
|
|
|
|
|
@projects = super.inside_path(group.full_path)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
|
|
|
Search::GroupService.prepend_if_ee('EE::Search::GroupService')
|