diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-11-07 19:06:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-07 19:06:44 +0100 |
commit | 1032f3994fdbd61c2f517057261ddc3559199b6b (patch) | |
tree | d039701515efc050dbf91124e8d32da2014498fb /app/models/account.rb | |
parent | cbbeec05be5cd0930a7be73bf673acc8d8105c12 (diff) |
Add ability to disable login and mark accounts as memorial (#5615)
Fix #5597
Diffstat (limited to 'app/models/account.rb')
-rw-r--r-- | app/models/account.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 3dc2a95ab..1142e7c79 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -41,6 +41,7 @@ # shared_inbox_url :string default(""), not null # followers_url :string default(""), not null # protocol :integer default("ostatus"), not null +# memorial :boolean default(FALSE), not null # class Account < ApplicationRecord @@ -150,6 +151,20 @@ class Account < ApplicationRecord ResolveRemoteAccountService.new.call(acct) end + def unsuspend! + transaction do + user&.enable! if local? + update!(suspended: false) + end + end + + def memorialize! + transaction do + user&.disable! if local? + update!(memorial: true) + end + end + def keypair @keypair ||= OpenSSL::PKey::RSA.new(private_key || public_key) end |