Account.find_acct! function

This commit is contained in:
Alex Gleason
2019-11-17 19:54:18 -06:00
parent 0aed68a7e3
commit a7955ad491
2 changed files with 10 additions and 6 deletions

View File

@@ -12,6 +12,10 @@ module AccountFinderConcern
find_remote(username, domain) || raise(ActiveRecord::RecordNotFound)
end
def find_acct!(acct)
find_acct(acct) || raise(ActiveRecord::RecordNotFound)
end
def representative
find_local(Setting.site_contact_username.strip.gsub(/\A@/, '')) || Account.local.without_suspended.first
end
@@ -23,6 +27,11 @@ module AccountFinderConcern
def find_remote(username, domain)
AccountFinder.new(username, domain).account
end
def find_acct(acct)
username, domain = acct.split("@")
find_remote(username, domain)
end
end
class AccountFinder