From a12572e074581832744b243f2fadd1742e8418b6 Mon Sep 17 00:00:00 2001 From: unarist Date: Sat, 9 Sep 2017 01:20:03 +0900 Subject: 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`. --- app/lib/activitypub/tag_manager.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app') 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 -- cgit