Add confirmation step to account suspensions (#8353)

* Add confirmation page for suspensions

* Suspension confirmation closes reports, linked from report UI

* Fix tests
This commit is contained in:
Eugen Rochko
2018-08-22 11:53:41 +02:00
committed by GitHub
parent 28de046b8b
commit 2374a00c10
12 changed files with 92 additions and 29 deletions

View File

@ -193,6 +193,13 @@ class Account < ApplicationRecord
ResolveAccountService.new.call(acct)
end
def suspend!
transaction do
user&.disable! if local?
update!(suspended: true)
end
end
def unsuspend!
transaction do
user&.enable! if local?

View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
class Form::AdminSuspensionConfirmation
include ActiveModel::Model
attr_accessor :acct, :report_id
end