From 2374a00c1062a70e9092d88579e1351e4c8128f9 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 22 Aug 2018 11:53:41 +0200 Subject: Add confirmation step to account suspensions (#8353) * Add confirmation page for suspensions * Suspension confirmation closes reports, linked from report UI * Fix tests --- app/models/account.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/models/account.rb') diff --git a/app/models/account.rb b/app/models/account.rb index c33ec4bd5..440a731e3 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -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? -- cgit