about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-04-16 10:38:29 -0400
committerEugen <eugen@zeonfederated.com>2017-04-16 16:38:29 +0200
commite0b5a94a4b98aa99369428af42216b308377c618 (patch)
treee48ee483c94421edf6dc2a8938b07ed79d4aee54 /app/services
parent26ec042f38eee5d5c0b2127cd199e27539e28cd0 (diff)
Clean up check that account needs a webfinger update (#1932)
Diffstat (limited to 'app/services')
-rw-r--r--app/services/follow_remote_account_service.rb6
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)]