mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-24 18:13:42 +01:00
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.
This commit is contained in:
parent
cea5597722
commit
c30e6433de
1 changed files with 2 additions and 2 deletions
|
@ -27,7 +27,7 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def in_reply_to
|
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')
|
if object.thread.uri.nil? || object.thread.uri.start_with?('http')
|
||||||
ActivityPub::TagManager.instance.uri_for(object.thread)
|
ActivityPub::TagManager.instance.uri_for(object.thread)
|
||||||
|
@ -67,7 +67,7 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def in_reply_to_atom_uri
|
def in_reply_to_atom_uri
|
||||||
return unless object.reply?
|
return unless object.reply? && !object.thread.nil?
|
||||||
|
|
||||||
::TagManager.instance.uri_for(object.thread)
|
::TagManager.instance.uri_for(object.thread)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue