1
0
mirror of https://github.com/funamitech/mastodon synced 2024-12-01 00:08:39 +09:00

Update remote ActivityPub users when fetching their toots (#5545)

This commit is contained in:
ThibG 2017-10-29 16:24:16 +01:00 committed by unarist
parent 2cea4592a3
commit d37a56c07c

View File

@ -16,7 +16,7 @@ class ActivityPub::FetchRemoteStatusService < BaseService
return if actor_id.nil? || !trustworthy_attribution?(@json['id'], actor_id) return if actor_id.nil? || !trustworthy_attribution?(@json['id'], actor_id)
actor = ActivityPub::TagManager.instance.uri_to_resource(actor_id, Account) 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? return if actor.suspended?
@ -44,4 +44,8 @@ class ActivityPub::FetchRemoteStatusService < BaseService
def expected_type? def expected_type?
%w(Note Article).include? @json['type'] %w(Note Article).include? @json['type']
end end
def needs_update(actor)
actor.possibly_stale?
end
end end