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:
Diffstat (limited to 'app/services/groups/destroy_service.rb')
-rw-r--r--app/services/groups/destroy_service.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/services/groups/destroy_service.rb b/app/services/groups/destroy_service.rb
index 5ffa746e109..c88c139a22e 100644
--- a/app/services/groups/destroy_service.rb
+++ b/app/services/groups/destroy_service.rb
@@ -11,11 +11,15 @@ module Groups
# rubocop: disable CodeReuse/ActiveRecord
def execute
+ # TODO - add a policy check here https://gitlab.com/gitlab-org/gitlab/-/issues/353082
+ raise DestroyError, "You can't delete this group because you're blocked." if current_user.blocked?
+
group.prepare_for_destroy
group.projects.includes(:project_feature).each do |project|
# Execute the destruction of the models immediately to ensure atomic cleanup.
success = ::Projects::DestroyService.new(project, current_user).execute
+
raise DestroyError, "Project #{project.id} can't be deleted" unless success
end