about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authorunarist <m.unarist@gmail.com>2017-09-09 01:20:03 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-09-08 18:20:03 +0200
commita12572e074581832744b243f2fadd1742e8418b6 (patch)
tree9139c1f0fcfb3e48b426a479dab5c565ce356639 /app/lib
parentdabc309ca3329c455e4e26a8bf9a691fcafe20a7 (diff)
Handle stream_entry URL correctly in ActivityPub (#4854)
In before, the method uses stream_entry id as status id, so replied status was wrongly selected.

This PR uses StatusFinder which was introduced with `Api::Web::EmbedsController`.
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/activitypub/tag_manager.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/lib/activitypub/tag_manager.rb b/app/lib/activitypub/tag_manager.rb
index de575d9e6..929e87852 100644
--- a/app/lib/activitypub/tag_manager.rb
+++ b/app/lib/activitypub/tag_manager.rb
@@ -96,12 +96,14 @@ class ActivityPub::TagManager
       when 'Account'
         klass.find_local(uri_to_local_id(uri, :username))
       else
-        klass.find_by(id: uri_to_local_id(uri))
+        StatusFinder.new(uri).status
       end
     elsif ::TagManager.instance.local_id?(uri)
       klass.find_by(id: ::TagManager.instance.unique_tag_to_local_id(uri, klass.to_s))
     else
       klass.find_by(uri: uri.split('#').first)
     end
+  rescue ActiveRecord::RecordNotFound
+    nil
   end
 end