Skip to content
Snippets Groups Projects
Commit c30e6433 authored by unarist's avatar unarist Committed by Eugen Rochko
Browse files

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.
parent cea55977
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment