summaryrefslogtreecommitdiff
path: root/app/services/groups
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2021-01-20 13:34:23 -0600
committerRobert Speicher <rspeicher@gmail.com>2021-01-20 13:34:23 -0600
commit6438df3a1e0fb944485cebf07976160184697d72 (patch)
tree00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /app/services/groups
parent42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff)
downloadgitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'app/services/groups')
-rw-r--r--app/services/groups/create_service.rb1
-rw-r--r--app/services/groups/destroy_service.rb23
2 files changed, 20 insertions, 4 deletions
diff --git a/app/services/groups/create_service.rb b/app/services/groups/create_service.rb
index 52600f5b88f..06a3b31c665 100644
--- a/app/services/groups/create_service.rb
+++ b/app/services/groups/create_service.rb
@@ -35,6 +35,7 @@ module Groups
@group.add_owner(current_user)
@group.create_namespace_settings
Service.create_from_active_default_integrations(@group, :group_id)
+ OnboardingProgress.onboard(@group)
end
end
diff --git a/app/services/groups/destroy_service.rb b/app/services/groups/destroy_service.rb
index 1bff70e6c2e..c7107e2fa56 100644
--- a/app/services/groups/destroy_service.rb
+++ b/app/services/groups/destroy_service.rb
@@ -29,17 +29,32 @@ module Groups
group.chat_team&.remove_mattermost_team(current_user)
- user_ids_for_project_authorizations_refresh = group.user_ids_for_project_authorizations
+ # If any other groups are shared with the group that is being destroyed,
+ # we should specifically trigger update of all project authorizations
+ # for users that are the members of this group.
+ # If not, the project authorization records of these users to projects within the shared groups
+ # will never be removed, causing inconsistencies with access permissions.
+ if any_other_groups_are_shared_with_this_group?
+ user_ids_for_project_authorizations_refresh = group.user_ids_for_project_authorizations
+ end
group.destroy
- UserProjectAccessChangedService
- .new(user_ids_for_project_authorizations_refresh)
- .execute(blocking: true)
+ if user_ids_for_project_authorizations_refresh.present?
+ UserProjectAccessChangedService
+ .new(user_ids_for_project_authorizations_refresh)
+ .execute(blocking: true)
+ end
group
end
# rubocop: enable CodeReuse/ActiveRecord
+
+ private
+
+ def any_other_groups_are_shared_with_this_group?
+ group.shared_group_links.any?
+ end
end
end