diff options
author | Effy Elden <github@effy.is> | 2017-04-17 01:41:33 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-17 01:41:33 +1000 |
commit | acd33101c50ba0cf09c1c41616f919d37760f3f7 (patch) | |
tree | 43564c181a7f58ce7471026bd0daa099344330e8 /app/services/follow_remote_account_service.rb | |
parent | fd81916e8625e5de39855522300eaeffd85ee13d (diff) | |
parent | 99226aba9391535a20d3cc6dba0f45e5792c73d4 (diff) |
Merge branch 'master' into fix/cache_blocking
Diffstat (limited to 'app/services/follow_remote_account_service.rb')
-rw-r--r-- | app/services/follow_remote_account_service.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/services/follow_remote_account_service.rb b/app/services/follow_remote_account_service.rb index dce712b40..14bc064d5 100644 --- a/app/services/follow_remote_account_service.rb +++ b/app/services/follow_remote_account_service.rb @@ -16,7 +16,7 @@ class FollowRemoteAccountService < BaseService return Account.find_local(username) if TagManager.instance.local_domain?(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}" @@ -62,6 +62,10 @@ class FollowRemoteAccountService < BaseService private + def account_needs_webfinger_update?(account) + account&.last_webfingered_at.nil? || account.last_webfingered_at <= 1.day.ago + end + def get_feed(url) response = http_client.get(Addressable::URI.parse(url)) [response.to_s, Nokogiri::XML(response)] |