summaryrefslogtreecommitdiff
path: root/app/services/groups
diff options
context:
space:
mode:
authorPeter Marko <peter.marko@siemens.com>2019-02-26 00:27:16 +0100
committerPeter Marko <peter.marko@siemens.com>2019-03-01 20:03:06 +0100
commitdea631545f580d22e63ff09f9d9f194a559d2612 (patch)
treed2453e0d682b278d57b8f5cc06cb211cd36a7d63 /app/services/groups
parentd86de642d16e0f7518c7f508b5282c89128e9a58 (diff)
downloadgitlab-ce-dea631545f580d22e63ff09f9d9f194a559d2612.tar.gz
fix group without owner after transfer
Diffstat (limited to 'app/services/groups')
-rw-r--r--app/services/groups/transfer_service.rb10
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