diff options
author | unarist <m.unarist@gmail.com> | 2017-09-16 22:00:36 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-09-16 15:00:36 +0200 |
commit | c30e6433de905c167f2920ced6b6bd659cf617eb (patch) | |
tree | 34f1ffdcee44c44d3ee12462c50ca37ebb3cc7a4 /app | |
parent | cea5597722bc7565e9d8dd21787492ba1570fbf4 (diff) |
Fix AP serialization error when thread is missing (#4970)
`Status#reply?` may returns true even if the thread is missing. e.g. the replied status was deleted or couldn't be fetched. Then it raises NoMethodError on various AP json serialization. This issue won't happen on Atom serialization because it checks thread existence using `StreamEntry#threaded?` instead.
Diffstat (limited to 'app')
-rw-r--r-- | app/serializers/activitypub/note_serializer.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb index 7d53537b5..166214eee 100644 --- a/app/serializers/activitypub/note_serializer.rb +++ b/app/serializers/activitypub/note_serializer.rb @@ -27,7 +27,7 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer end def in_reply_to - return unless object.reply? + return unless object.reply? && !object.thread.nil? if object.thread.uri.nil? || object.thread.uri.start_with?('http') ActivityPub::TagManager.instance.uri_for(object.thread) @@ -67,7 +67,7 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer end def in_reply_to_atom_uri - return unless object.reply? + return unless object.reply? && !object.thread.nil? ::TagManager.instance.uri_for(object.thread) end |