diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-08-20 06:26:19 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-08-30 05:45:19 -0500 |
commit | 6317cb60e03762596ecae034518b4da4c60a8f64 (patch) | |
tree | d0ed510079f5373fe8d2cb420d93866ae32201f2 /app/lib/activitypub/activity/create.rb | |
parent | 4d08871722a9186f0c82c41c6a465982f80c06b2 (diff) |
[Federation, Feature] Add support for pull federation, account synchronization, and server-to-server migration
Diffstat (limited to 'app/lib/activitypub/activity/create.rb')
-rw-r--r-- | app/lib/activitypub/activity/create.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index d37203c40..23786c1cc 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -378,16 +378,17 @@ class ActivityPub::Activity::Create < ActivityPub::Activity end def fetch_replies(status) - FetchReplyWorker.perform_async(@object['root']) unless @object['root'].blank? || [object_uri, @object['url']].include?(@object['root']) || status_from_uri(@object['root']) + FetchReplyWorker.perform_async(@object['root']) unless invalid_root_uri? collection = @object['replies'] return if collection.nil? - replies = ActivityPub::FetchRepliesService.new.call(status, collection, false) - return unless replies.nil? - - uri = value_or_id(collection) - ActivityPub::FetchRepliesWorker.perform_async(status.id, uri) unless uri.nil? + if collection.is_a?(Hash) + ActivityPub::FetchRepliesService.new.call(status, collection) + else + uri = value_or_id(collection) + ActivityPub::FetchRepliesWorker.perform_async(status.id, uri) unless uri.nil? + end end def conversation_from_uri(uri) @@ -548,6 +549,10 @@ class ActivityPub::Activity::Create < ActivityPub::Activity @skip_download ||= DomainBlock.reject_media?(@account.domain) end + def invalid_root_uri? + @object['root'].blank? || [object_uri, @object['url']].include?(@object['root']) || status_from_uri(@object['root']) + end + def check_for_spam SpamCheck.perform(@status) end |