]> cat aescling's git repositories - mastodon.git/commitdiff
Update remote ActivityPub users when fetching their toots (#5545)
authorThibG <thib@sitedethib.com>
Sun, 29 Oct 2017 15:24:16 +0000 (16:24 +0100)
committerunarist <m.unarist@gmail.com>
Sun, 29 Oct 2017 15:24:16 +0000 (00:24 +0900)
app/services/activitypub/fetch_remote_status_service.rb

index e2a89a87c8a89ca1b0052dfd66345b5867e01b71..8d7b7a17cea4e6affd907684b367ad0f64ed697c 100644 (file)
@@ -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