diff options
author | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2016-03-12 15:11:30 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2016-03-15 23:09:25 +0300 |
commit | 8077a5f9589e365f58f22015819bff7debcd7299 (patch) | |
tree | 29ae91d16fdce68d9ae1004cfcd6eb088e72e324 /app | |
parent | a09323c9f5df69a60d00278dec64775821751711 (diff) |
Clearify who deletes the user
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/abuse_reports_controller.rb | 2 | ||||
-rw-r--r-- | app/models/abuse_report.rb | 4 | ||||
-rw-r--r-- | app/services/delete_user_service.rb | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/app/controllers/admin/abuse_reports_controller.rb b/app/controllers/admin/abuse_reports_controller.rb index a3f78e34776..e9b0972bdd8 100644 --- a/app/controllers/admin/abuse_reports_controller.rb +++ b/app/controllers/admin/abuse_reports_controller.rb @@ -6,7 +6,7 @@ class Admin::AbuseReportsController < Admin::ApplicationController def destroy abuse_report = AbuseReport.find(params[:id]) - abuse_report.remove_user(current_user) if params[:remove_user] + abuse_report.remove_user(deleted_by: current_user) if params[:remove_user] abuse_report.destroy render nothing: true diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb index 155b5f327cb..b61f5123127 100644 --- a/app/models/abuse_report.rb +++ b/app/models/abuse_report.rb @@ -19,9 +19,9 @@ class AbuseReport < ActiveRecord::Base validates :message, presence: true validates :user_id, uniqueness: { message: 'has already been reported' } - def remove_user(current_user) + def remove_user(deleted_by:) user.block - DeleteUserWorker.perform_async(current_user.id, user.id, force: true) + DeleteUserWorker.perform_async(deleted_by.id, user.id, delete_solo_owned_groups: true) end def notify diff --git a/app/services/delete_user_service.rb b/app/services/delete_user_service.rb index 5f2e4f75b79..ce79287e35a 100644 --- a/app/services/delete_user_service.rb +++ b/app/services/delete_user_service.rb @@ -6,7 +6,7 @@ class DeleteUserService end def execute(user, options = {}) - if !options[:force] && user.solo_owned_groups.present? + if !options[:delete_solo_owned_groups] && user.solo_owned_groups.present? user.errors[:base] << 'You must transfer ownership or delete groups before you can remove user' return user end |