diff options
author | Peter Marko <peter.marko@siemens.com> | 2019-04-02 09:49:11 +0300 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2019-04-02 09:49:11 +0300 |
commit | 22fe2fb4c11c16739a3a1bb97569884db70ac546 (patch) | |
tree | 363f91b4822d32bdccb927af1d80d081beb76a7d /app/helpers | |
parent | ba23d6377c650ecaac420c8085a2cd82737d3ced (diff) |
Fix group transfer selection possibilities
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/groups_helper.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 9d028dccad7..7af766c8544 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -118,11 +118,12 @@ module GroupsHelper end def parent_group_options(current_group) - groups = current_user.owned_groups.sort_by(&:human_name).map do |group| + exclude_groups = current_group.self_and_descendants.pluck_primary_key + exclude_groups << current_group.parent_id if current_group.parent_id + groups = GroupsFinder.new(current_user, min_access_level: Gitlab::Access::OWNER, exclude_group_ids: exclude_groups).execute.sort_by(&:human_name).map do |group| { id: group.id, text: group.human_name } end - groups.delete_if { |group| group[:id] == current_group.id } groups.to_json end |