mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 16:59:41 +00:00
Fix crash when serializing quotes of deleted posts for ActivityPub (#36381)
This commit is contained in:
@@ -32,8 +32,8 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
attribute :voters_count, if: :poll_and_voters_count?
|
||||
|
||||
attribute :quote, if: :quote?
|
||||
attribute :quote, key: :_misskey_quote, if: :quote?
|
||||
attribute :quote, key: :quote_uri, if: :quote?
|
||||
attribute :quote, key: :_misskey_quote, if: :serializable_quote?
|
||||
attribute :quote, key: :quote_uri, if: :serializable_quote?
|
||||
attribute :quote_authorization, if: :quote_authorization?
|
||||
|
||||
attribute :interaction_policy
|
||||
@@ -214,13 +214,17 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
object.quote&.present?
|
||||
end
|
||||
|
||||
def serializable_quote?
|
||||
object.quote&.quoted_status&.present?
|
||||
end
|
||||
|
||||
def quote_authorization?
|
||||
object.quote.present? && ActivityPub::TagManager.instance.approval_uri_for(object.quote).present?
|
||||
end
|
||||
|
||||
def quote
|
||||
# TODO: handle inlining self-quotes
|
||||
ActivityPub::TagManager.instance.uri_for(object.quote.quoted_status)
|
||||
object.quote.quoted_status.present? ? ActivityPub::TagManager.instance.uri_for(object.quote.quoted_status) : { type: 'Tombstone' }
|
||||
end
|
||||
|
||||
def quote_authorization
|
||||
|
||||
Reference in New Issue
Block a user