summaryrefslogtreecommitdiff
path: root/app/services/users/destroy_service.rb
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2018-08-13 14:54:31 +0300
committerValery Sizov <valery@gitlab.com>2018-08-17 12:23:27 +0300
commitfbf618fc3817442ef17848b67738ff456d65e7e4 (patch)
tree9ff5c3affb8c9fad044d5fd60942c8fb5666574e /app/services/users/destroy_service.rb
parent5bf9f5b67bf50f2fd3dd8f7fb67239c958b25c9a (diff)
downloadgitlab-ce-fbf618fc3817442ef17848b67738ff456d65e7e4.tar.gz
Fix: Project deletion may not log audit events during user deletion
Diffstat (limited to 'app/services/users/destroy_service.rb')
-rw-r--r--app/services/users/destroy_service.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/services/users/destroy_service.rb b/app/services/users/destroy_service.rb
index 4bc78b5b64e..73fa6089945 100644
--- a/app/services/users/destroy_service.rb
+++ b/app/services/users/destroy_service.rb
@@ -2,6 +2,8 @@
module Users
class DestroyService
+ DestroyError = Class.new(StandardError)
+
attr_accessor :current_user
def initialize(current_user)
@@ -46,9 +48,8 @@ module Users
namespace.prepare_for_destroy
user.personal_projects.each do |project|
- # Skip repository removal because we remove directory with namespace
- # that contain all this repositories
- ::Projects::DestroyService.new(project, current_user, skip_repo: project.legacy_storage?).execute
+ success = ::Projects::DestroyService.new(project, current_user).execute
+ raise DestroyError, "Project #{project.id} can't be deleted" unless success
end
yield(user) if block_given?