diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-28 03:09:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-28 03:09:08 +0300 |
commit | f54a50aa826d0eedcf2e56f51462613bc132f826 (patch) | |
tree | 7194aca23f9af822ea55966a6f477b3d8d68ee47 /app/services/users | |
parent | c77fda905a8619b756163c10a75171dc9cfe7084 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/users')
-rw-r--r-- | app/services/users/destroy_service.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/services/users/destroy_service.rb b/app/services/users/destroy_service.rb index ef79ee3d06e..587a8516394 100644 --- a/app/services/users/destroy_service.rb +++ b/app/services/users/destroy_service.rb @@ -56,10 +56,13 @@ module Users MigrateToGhostUserService.new(user).execute unless options[:hard_delete] + response = Snippets::BulkDestroyService.new(current_user, user.snippets).execute + raise DestroyError, response.message if response.error? + # Rails attempts to load all related records into memory before # destroying: https://github.com/rails/rails/issues/22510 # This ensures we delete records in batches. - user.destroy_dependent_associations_in_batches + user.destroy_dependent_associations_in_batches(exclude: [:snippets]) # Destroy the namespace after destroying the user since certain methods may depend on the namespace existing user_data = user.destroy |