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)
|
|
|
|
|
|
|
|
@group = group
|
|
|
|
end
|
|
|
|
|
2018-08-15 09:25:17 -04:00
|
|
|
def execute
|
|
|
|
Gitlab::GroupSearchResults.new(
|
2020-08-20 23:10:16 -04:00
|
|
|
current_user,
|
|
|
|
params[:search],
|
|
|
|
projects,
|
2020-09-03 17:08:18 -04:00
|
|
|
group: group,
|
2020-11-04 19:09:16 -05:00
|
|
|
order_by: params[:order_by],
|
2020-10-07 02:09:03 -04:00
|
|
|
sort: params[:sort],
|
2020-09-25 05:09:40 -04:00
|
|
|
filters: { state: params[:state], confidential: params[:confidential] }
|
2018-08-15 09:25:17 -04:00
|
|
|
)
|
|
|
|
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
|
|
|
|
2021-05-11 17:10:21 -04:00
|
|
|
Search::GroupService.prepend_mod_with('Search::GroupService')
|