Add ability to disable login and mark accounts as memorial (#5615)

Fix #5597
This commit is contained in:
Eugen Rochko
2017-11-07 19:06:44 +01:00
committed by GitHub
parent cbbeec05be
commit 1032f3994f
17 changed files with 168 additions and 39 deletions

View File

@ -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