Skip to content

Fix error when deleting a user who has projects

Stan Hu requested to merge stanhu/gitlab-ce:fix-delete-user-error into master

What does this MR do?

This MR fixes an error that prevented users from being deleted in the Admin page if the user had personal projects.

Why was this MR needed?

Deleting a user who had projects would result in an error such as this:

Started DELETE "/admin/users/tdb1" for MYIP at 2015-06-22 20:53:02 +0100
Processing by Admin::UsersController#destroy as HTML
Parameters: {"authenticity_token"=>"[FILTERED]", "id"=>"tdb1"}
Completed 500 Internal Server Error in 30ms (ActiveRecord: 6.7ms)

NameError (undefined local variable or method `current_user' for #<DeleteUserService:0x0000000cd01d38>):
app/services/delete_user_service.rb:10:in `block in execute'
app/services/delete_user_service.rb:7:in `execute'
app/controllers/admin/users_controller.rb:89:in `destroy'

What are the relevant issue numbers?

Merge request reports