diff options
author | Sean McGivern <sean@gitlab.com> | 2019-03-07 12:42:15 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-03-07 12:42:15 +0300 |
commit | 600fcb1562ba935a2636fc044567017e729a2876 (patch) | |
tree | 146b780a93b9af2bd2946527a558003c34897a4f /app/services/groups | |
parent | cce51dc73ee02bb8f49bea6f3c18a3b7546a11b7 (diff) | |
parent | dea631545f580d22e63ff09f9d9f194a559d2612 (diff) |
Merge branch 'fix-group-without-owner' into 'master'
fix group without owner after transfer
Closes #58086
See merge request gitlab-org/gitlab-ce!25573
Diffstat (limited to 'app/services/groups')
-rw-r--r-- | app/services/groups/transfer_service.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/services/groups/transfer_service.rb b/app/services/groups/transfer_service.rb index f64e327416a..94185605ab9 100644 --- a/app/services/groups/transfer_service.rb +++ b/app/services/groups/transfer_service.rb @@ -35,7 +35,10 @@ module Groups def proceed_to_transfer Group.transaction do update_group_attributes + ensure_ownership end + + true end def ensure_allowed_transfer @@ -95,6 +98,13 @@ module Groups end # rubocop: enable CodeReuse/ActiveRecord + def ensure_ownership + return if @new_parent_group + return unless @group.owners.empty? + + @group.add_owner(current_user) + end + def raise_transfer_error(message) raise TransferError, ERROR_MESSAGES[message] end |