Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessio Caiazza <acaiazza@gitlab.com>2019-12-09 12:19:58 +0300
committerAlessio Caiazza <acaiazza@gitlab.com>2019-12-09 12:19:58 +0300
commit3fe0553ecc628af1877497ffb71ab96ea65b0b4b (patch)
tree8116cdb077fc44fcb290ad6e47cbb98e381e514e
parent0330bd0a0a646da26b7cc5d16a00c763d82b8649 (diff)
parent1a7c008f8dd0a5f3f54e30535947effffed8472a (diff)
Merge branch 'security-37766-transfer-group-reindex-ce-12-5' into '12-5-stable'
Trigger Elasticsearch indexing when public group moved to private See merge request gitlab/gitlabhq!3577
-rw-r--r--app/services/groups/transfer_service.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/app/services/groups/transfer_service.rb b/app/services/groups/transfer_service.rb
index 24813f6ddf9..4e7875e0491 100644
--- a/app/services/groups/transfer_service.rb
+++ b/app/services/groups/transfer_service.rb
@@ -39,9 +39,15 @@ module Groups
ensure_ownership
end
+ post_update_hooks(@updated_project_ids)
+
true
end
+ # Overridden in EE
+ def post_update_hooks(updated_project_ids)
+ end
+
def ensure_allowed_transfer
raise_transfer_error(:group_is_already_root) if group_is_already_root?
raise_transfer_error(:same_parent_as_current) if same_parent?
@@ -96,9 +102,16 @@ module Groups
.where(id: descendants.select(:id))
.update_all(visibility_level: @new_parent_group.visibility_level)
- @group
+ projects_to_update = @group
.all_projects
.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)
end
# rubocop: enable CodeReuse/ActiveRecord