diff options
author | Benjamin Neff <benjamin@coding4coffee.ch> | 2015-06-13 15:15:14 +0300 |
---|---|---|
committer | Dennis Schubert <mail@dennis-schubert.de> | 2015-07-14 06:50:26 +0300 |
commit | f875be8d5b1bb59cc4ed1c2520854753faf29fb9 (patch) | |
tree | 52bdf910f6078fc974265138569eb7c2648e468b /app/models/person.rb | |
parent | 9eadc251aefb4206884a1068dce6e62a914bc54c (diff) |
use federation-gem for webfinger/hcard generation
remove old webfinger/hcard generation code
this fixes #5143
Diffstat (limited to 'app/models/person.rb')
-rw-r--r-- | app/models/person.rb | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/app/models/person.rb b/app/models/person.rb index 814dfe1e0..e419cce30 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -28,7 +28,7 @@ class Person < ActiveRecord::Base xml_attr :profile, :as => Profile xml_attr :exported_key - has_one :profile, :dependent => :destroy + has_one :profile, dependent: :destroy delegate :last_name, :image_url, :tag_string, :bio, :location, :gender, :birthday, :formatted_birthday, :tags, :searchable, to: :profile @@ -222,7 +222,7 @@ class Person < ActiveRecord::Base end def public_key_hash - Base64.encode64(OpenSSL::Digest::SHA256.new(self.exported_key).to_s) + Base64.encode64(OpenSSL::Digest::SHA256.new(serialized_public_key).to_s) end def public_key @@ -238,15 +238,18 @@ class Person < ActiveRecord::Base serialized_public_key = new_key end - #database calls + # database calls def self.by_account_identifier(identifier) - identifier = identifier.strip.downcase.gsub('acct:', '') - self.where(:diaspora_handle => identifier).first + identifier = identifier.strip.downcase.sub("acct:", "") + find_by(diaspora_handle: identifier) end - def self.local_by_account_identifier(identifier) - person = self.by_account_identifier(identifier) - (person.nil? || person.remote?) ? nil : person + def self.find_local_by_diaspora_handle(handle) + where(diaspora_handle: handle, closed_account: false).where.not(owner: nil).take + end + + def self.find_local_by_guid(guid) + where(guid: guid, closed_account: false).where.not(owner: nil).take end def self.create_from_webfinger(profile, hcard) |