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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-05 12:21:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-05 12:21:54 +0300
commita92d6b36c2d2892e8c070efb169f0c06815900ee (patch)
treee7119c41b0e0d0eb0cff50b19fbb2bb34315f5a4 /app/services/groups
parent39a48637e52c4afc58341edfb10167947d961b33 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/groups')
-rw-r--r--app/services/groups/group_links/destroy_service.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/services/groups/group_links/destroy_service.rb b/app/services/groups/group_links/destroy_service.rb
new file mode 100644
index 00000000000..29aa8de4e68
--- /dev/null
+++ b/app/services/groups/group_links/destroy_service.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+module Groups
+ module GroupLinks
+ class DestroyService < BaseService
+ def execute(one_or_more_links)
+ links = Array(one_or_more_links)
+
+ GroupGroupLink.transaction do
+ GroupGroupLink.delete(links)
+
+ groups_to_refresh = links.map(&:shared_with_group)
+ groups_to_refresh.uniq.each do |group|
+ group.refresh_members_authorized_projects
+ end
+
+ Gitlab::AppLogger.info("GroupGroupLinks with ids: #{links.map(&:id)} have been deleted.")
+ rescue => ex
+ Gitlab::AppLogger.error(ex)
+
+ raise
+ end
+ end
+ end
+ end
+end