about summary refs log tree commit diff
path: root/app/services/fetch_remote_status_service.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-08-14 02:29:36 +0200
committerGitHub <noreply@github.com>2017-08-14 02:29:36 +0200
commit4e75f0d88932511ad154773f4c77a485367ed36c (patch)
tree3b0656542633fc80ac7b657d8ee2694ca8bc2fdc /app/services/fetch_remote_status_service.rb
parenta2aeacbfeed5dc7070c37a22bb2c4bac1a58a526 (diff)
Hook up URL-based resource look-up to ActivityPub (#4589)
Diffstat (limited to 'app/services/fetch_remote_status_service.rb')
-rw-r--r--app/services/fetch_remote_status_service.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/app/services/fetch_remote_status_service.rb b/app/services/fetch_remote_status_service.rb
index b9f5f97b1..30d8d2538 100644
--- a/app/services/fetch_remote_status_service.rb
+++ b/app/services/fetch_remote_status_service.rb
@@ -5,14 +5,19 @@ class FetchRemoteStatusService < BaseService
 
   def call(url, prefetched_body = nil)
     if prefetched_body.nil?
-      atom_url, body = FetchAtomService.new.call(url)
+      resource_url, body, protocol = FetchAtomService.new.call(url)
     else
-      atom_url = url
-      body     = prefetched_body
+      resource_url = url
+      body         = prefetched_body
+      protocol     = :ostatus
     end
 
-    return nil if atom_url.nil?
-    process_atom(atom_url, body)
+    case protocol
+    when :ostatus
+      process_atom(resource_url, body)
+    when :activitypub
+      ActivityPub::FetchRemoteStatusService.new.call(resource_url, body)
+    end
   end
 
   private