about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2017-10-29 16:24:16 +0100
committerunarist <m.unarist@gmail.com>2017-10-30 00:24:16 +0900
commitd37a56c07cdc475f9a0f5a87d65d1e258c48644b (patch)
tree8534ae300f7131cb2adc2e13ffd6e650b5a81063 /app/services
parent2cea4592a3fe0164d3a4dd2ff1a2ddf5afee1c31 (diff)
Update remote ActivityPub users when fetching their toots (#5545)
Diffstat (limited to 'app/services')
-rw-r--r--app/services/activitypub/fetch_remote_status_service.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/services/activitypub/fetch_remote_status_service.rb b/app/services/activitypub/fetch_remote_status_service.rb
index e2a89a87c..8d7b7a17c 100644
--- a/app/services/activitypub/fetch_remote_status_service.rb
+++ b/app/services/activitypub/fetch_remote_status_service.rb
@@ -16,7 +16,7 @@ class ActivityPub::FetchRemoteStatusService < BaseService
     return if actor_id.nil? || !trustworthy_attribution?(@json['id'], actor_id)
 
     actor = ActivityPub::TagManager.instance.uri_to_resource(actor_id, Account)
-    actor = ActivityPub::FetchRemoteAccountService.new.call(actor_id, id: true) if actor.nil?
+    actor = ActivityPub::FetchRemoteAccountService.new.call(actor_id, id: true) if actor.nil? || needs_update(actor)
 
     return if actor.suspended?
 
@@ -44,4 +44,8 @@ class ActivityPub::FetchRemoteStatusService < BaseService
   def expected_type?
     %w(Note Article).include? @json['type']
   end
+
+  def needs_update(actor)
+    actor.possibly_stale?
+  end
 end