diff options
Diffstat (limited to 'lib/api/groups.rb')
-rw-r--r-- | lib/api/groups.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb index 82bbab5d7d4..6b1fc0d4279 100644 --- a/lib/api/groups.rb +++ b/lib/api/groups.rb @@ -96,9 +96,9 @@ module API present options[:with].prepare_relation(projects, options), options end - def present_groups(params, groups) + def present_groups(params, groups, serializer: Entities::Group) options = { - with: Entities::Group, + with: serializer, current_user: current_user, statistics: params[:statistics] && current_user&.admin? } @@ -248,6 +248,8 @@ module API authorize! :admin_group, group + group.remove_avatar! if params.key?(:avatar) && params[:avatar].nil? + if update_group(group) present_group_details(params, group, with_projects: true) else @@ -392,6 +394,21 @@ module API end end + desc 'Get the groups to where the current group can be transferred to' + params do + optional :search, type: String, desc: 'Return list of namespaces matching the search criteria' + use :pagination + end + get ':id/transfer_locations', feature_category: :subgroups do + authorize! :admin_group, user_group + args = declared_params(include_missing: false) + + groups = ::Groups::AcceptingGroupTransfersFinder.new(current_user, user_group, args).execute + groups = groups.with_route + + present_groups params, groups, serializer: Entities::PublicGroupDetails + end + desc 'Transfer a group to a new parent group or promote a subgroup to a root group' params do optional :group_id, |