mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-07-23 00:47:51 +00:00
39 lines
1.0 KiB
Ruby
39 lines
1.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module Gitlab
|
|
class GroupSearchResults < SearchResults
|
|
attr_reader :group
|
|
|
|
def initialize(current_user, query, limit_projects = nil, group:, **opts)
|
|
@group = group
|
|
super(
|
|
current_user,
|
|
query,
|
|
limit_projects,
|
|
default_project_filter: opts.fetch(:default_project_filter, false),
|
|
order_by: opts.fetch(:order_by, nil),
|
|
sort: opts.fetch(:sort, nil),
|
|
filters: opts.fetch(:filters, {}),
|
|
source: opts.fetch(:source, nil)
|
|
)
|
|
end
|
|
|
|
# rubocop:disable CodeReuse/ActiveRecord
|
|
def users
|
|
groups = group.self_and_hierarchy_intersecting_with_user_groups(current_user)
|
|
members = GroupMember.where(group: groups).non_invite
|
|
|
|
users = super
|
|
|
|
users.where(id: members.select(:user_id))
|
|
end
|
|
# rubocop:enable CodeReuse/ActiveRecord
|
|
|
|
def issuable_params
|
|
super.merge(group_id: group.id, include_subgroups: true)
|
|
end
|
|
end
|
|
end
|
|
|
|
Gitlab::GroupSearchResults.prepend_mod_with('Gitlab::GroupSearchResults')
|