diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-01-12 20:48:16 -0500 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-01-12 20:59:55 -0500 |
commit | da40274fdc60fe17f928b80eb71c211e27523d5e (patch) | |
tree | c79f5f258df0354a6f910642a3c1f48e786c6b04 /app/models/abuse_report.rb | |
parent | 1813adcdeaef1f27c17dfb98ecf07c57d7687e11 (diff) | |
download | gitlab-ce-da40274fdc60fe17f928b80eb71c211e27523d5e.tar.gz |
Block the reported user before destroying the recordrs-block-user-before-removal
This is intended to prevent the user from creating new objects while the
transaction that removes them is being run, resulting in objects with
nil authors which can then not be edited.
See https://gitlab.com/gitlab-org/gitlab-ce/issues/7117
Diffstat (limited to 'app/models/abuse_report.rb')
-rw-r--r-- | app/models/abuse_report.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb index 55864236b2f..2bc15c60d57 100644 --- a/app/models/abuse_report.rb +++ b/app/models/abuse_report.rb @@ -19,6 +19,11 @@ class AbuseReport < ActiveRecord::Base validates :message, presence: true validates :user_id, uniqueness: true + def remove_user + user.block + user.destroy + end + def notify return unless self.persisted? |