diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-07 00:11:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-07 00:11:04 +0300 |
commit | 9a4d4b7b9923c027b9bbfc256e5be463c481cbb2 (patch) | |
tree | b39696bccdd4ed717666eae6026db626363be146 /app/services/groups | |
parent | c01e203d86defff72f655006b52536d6acb6322d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/groups')
-rw-r--r-- | app/services/groups/update_service.rb | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/app/services/groups/update_service.rb b/app/services/groups/update_service.rb index b3b0397eac3..2135892a95a 100644 --- a/app/services/groups/update_service.rb +++ b/app/services/groups/update_service.rb @@ -61,15 +61,18 @@ module Groups end def before_assignment_hook(group, params) - # overridden in EE + @full_path_before = group.full_path + @path_before = group.path end def renaming_group_with_container_registry_images? + renaming? && group.has_container_repository_including_subgroups? + end + + def renaming? new_path = params[:path] - new_path && - new_path != group.path && - group.has_container_repository_including_subgroups? + new_path && new_path != @path_before end def container_images_error @@ -83,6 +86,8 @@ module Groups end update_two_factor_requirement_for_subgroups + + publish_event end def update_two_factor_requirement_for_subgroups @@ -154,6 +159,21 @@ module Groups group.errors.add(:update_shared_runners, result[:message]) false end + + def publish_event + return unless renaming? + + event = Groups::GroupPathChangedEvent.new( + data: { + group_id: group.id, + root_namespace_id: group.root_ancestor.id, + old_path: @full_path_before, + new_path: group.full_path + } + ) + + Gitlab::EventStore.publish(event) + end end end |