Serialize legacy quotes (#3203)

This commit is contained in:
Asahi Lina
2025-11-11 21:23:51 +09:00
committed by GitHub
parent 565f437f93
commit 394ed551bb

View File

@@ -33,7 +33,7 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
attribute :voters_count, if: :poll_and_voters_count?
attribute :quote, if: :quote?
attribute :quote, if: :nonlegacy_quote?
attribute :quote, key: :_misskey_quote, if: :serializable_quote?
attribute :quote, key: :quote_uri, if: :serializable_quote?
attribute :quote_authorization, if: :quote_authorization?
@@ -230,6 +230,10 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
object.quote&.quoted_status&.present?
end
def nonlegacy_quote?
object.quote.present? && !object.quote.legacy?
end
def quote_authorization?
object.quote.present? && ActivityPub::TagManager.instance.approval_uri_for(object.quote).present?
end