From 9107a290c1968519f764f86ec6ec6963e0750ec0 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sun, 25 Dec 2022 04:02:08 +0000 Subject: [PATCH] th: status: prevent recursion when serializing --- app/serializers/rest/status_serializer.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index b6b09a5b37..f33f499a5d 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -23,7 +23,6 @@ class REST::StatusSerializer < ActiveModel::Serializer belongs_to :reblog, serializer: REST::StatusSerializer belongs_to :application, if: :show_application? 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_mentions, key: :mentions @@ -185,3 +184,13 @@ class REST::StatusSerializer < ActiveModel::Serializer 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