|
|
@ -16,7 +16,7 @@ class FollowRemoteAccountService < BaseService
|
|
|
|
return Account.find_local(username) if TagManager.instance.local_domain?(domain)
|
|
|
|
return Account.find_local(username) if TagManager.instance.local_domain?(domain)
|
|
|
|
|
|
|
|
|
|
|
|
account = Account.find_remote(username, domain)
|
|
|
|
account = Account.find_remote(username, domain)
|
|
|
|
return account unless account&.last_webfingered_at.nil? || 1.day.from_now(account.last_webfingered_at) < Time.now.utc
|
|
|
|
return account unless account_needs_webfinger_update?(account)
|
|
|
|
|
|
|
|
|
|
|
|
Rails.logger.debug "Looking up webfinger for #{uri}"
|
|
|
|
Rails.logger.debug "Looking up webfinger for #{uri}"
|
|
|
|
|
|
|
|
|
|
|
@ -62,6 +62,10 @@ class FollowRemoteAccountService < BaseService
|
|
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def account_needs_webfinger_update?(account)
|
|
|
|
|
|
|
|
account&.last_webfingered_at.nil? || account.last_webfingered_at <= 1.day.ago
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def get_feed(url)
|
|
|
|
def get_feed(url)
|
|
|
|
response = http_client.get(Addressable::URI.parse(url))
|
|
|
|
response = http_client.get(Addressable::URI.parse(url))
|
|
|
|
[response.to_s, Nokogiri::XML(response)]
|
|
|
|
[response.to_s, Nokogiri::XML(response)]
|
|
|
|