status: prevent recursion when serializing

feature/quote
Ariadne Conill 2022-12-25 04:02:08 +00:00
parent 1cef1eb847
commit 36955a7a56
1 changed files with 10 additions and 1 deletions

View File

@ -23,7 +23,6 @@ class REST::StatusSerializer < ActiveModel::Serializer
belongs_to :reblog, serializer: REST::StatusSerializer belongs_to :reblog, serializer: REST::StatusSerializer
belongs_to :application, if: :show_application? belongs_to :application, if: :show_application?
belongs_to :account, serializer: REST::AccountSerializer belongs_to :account, serializer: REST::AccountSerializer
belongs_to :quote, serializer: REST::StatusSerializer
has_many :ordered_media_attachments, key: :media_attachments, serializer: REST::MediaAttachmentSerializer has_many :ordered_media_attachments, key: :media_attachments, serializer: REST::MediaAttachmentSerializer
has_many :ordered_mentions, key: :mentions has_many :ordered_mentions, key: :mentions
@ -185,3 +184,13 @@ class REST::StatusSerializer < ActiveModel::Serializer
end end
end end
end end
class REST::QuoteStatusSerializer < REST::StatusSerializer
attribute :quote do
nil
end
end
class REST::StatusSerializer < ActiveModel::Serializer
belongs_to :quote, serializer: REST::QuoteStatusSerializer
end