提交 eb797d46 编写于 作者: G GitLab Release Tools Bot

Merge remote-tracking branch 'dev/12-3-stable' into 12-3-stable

...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
documentation](doc/development/changelog.md) for instructions on adding your own documentation](doc/development/changelog.md) for instructions on adding your own
entry. entry.
## 12.3.9
- No changes.
## 12.3.8 ## 12.3.8
- No changes. - No changes.
......
...@@ -38,9 +38,15 @@ module Groups ...@@ -38,9 +38,15 @@ module Groups
ensure_ownership ensure_ownership
end end
post_update_hooks(@updated_project_ids)
true true
end end
# Overridden in EE
def post_update_hooks(updated_project_ids)
end
def ensure_allowed_transfer def ensure_allowed_transfer
raise_transfer_error(:group_is_already_root) if group_is_already_root? raise_transfer_error(:group_is_already_root) if group_is_already_root?
raise_transfer_error(:same_parent_as_current) if same_parent? raise_transfer_error(:same_parent_as_current) if same_parent?
...@@ -90,9 +96,16 @@ module Groups ...@@ -90,9 +96,16 @@ module Groups
.where(id: descendants.select(:id)) .where(id: descendants.select(:id))
.update_all(visibility_level: @new_parent_group.visibility_level) .update_all(visibility_level: @new_parent_group.visibility_level)
@group projects_to_update = @group
.all_projects .all_projects
.where("visibility_level > ?", @new_parent_group.visibility_level) .where("visibility_level > ?", @new_parent_group.visibility_level)
# Used in post_update_hooks in EE. Must use pluck (and not select)
# here as after we perform the update below we won't be able to find
# these records again.
@updated_project_ids = projects_to_update.pluck(:id)
projects_to_update
.update_all(visibility_level: @new_parent_group.visibility_level) .update_all(visibility_level: @new_parent_group.visibility_level)
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
...@@ -109,3 +122,5 @@ module Groups ...@@ -109,3 +122,5 @@ module Groups
end end
end end
end end
Groups::TransferService.prepend_if_ee('EE::Groups::TransferService')
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册