2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
class GroupSearchResults < SearchResults
|
|
|
|
attr_reader :group
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
def initialize(current_user, query, limit_projects = nil, group:, default_project_filter: false, order_by: nil, sort: nil, filters: {})
|
2019-07-07 11:18:12 +05:30
|
|
|
@group = group
|
2020-11-24 15:15:51 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
super(current_user, query, limit_projects, default_project_filter: default_project_filter, order_by: order_by, sort: sort, filters: filters)
|
2019-07-07 11:18:12 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
# rubocop:disable CodeReuse/ActiveRecord
|
|
|
|
def users
|
2023-03-04 22:38:38 +05:30
|
|
|
groups = group.self_and_hierarchy_intersecting_with_user_groups(current_user)
|
|
|
|
members = GroupMember.where(group: groups).non_invite
|
2020-11-24 15:15:51 +05:30
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
users = super
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
users.where(id: members.select(:user_id))
|
2019-07-07 11:18:12 +05:30
|
|
|
end
|
|
|
|
# rubocop:enable CodeReuse/ActiveRecord
|
|
|
|
|
|
|
|
def issuable_params
|
2020-03-13 15:44:24 +05:30
|
|
|
super.merge(group_id: group.id, include_subgroups: true)
|
2019-07-07 11:18:12 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
Gitlab::GroupSearchResults.prepend_mod_with('Gitlab::GroupSearchResults')
|