Fix quote nesting at once, add quote_id
This commit is contained in:
parent
794ad9dbc6
commit
59749d09d9
@ -15,10 +15,11 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
|||||||
attribute :content, unless: :source_requested?
|
attribute :content, unless: :source_requested?
|
||||||
attribute :text, if: :source_requested?
|
attribute :text, if: :source_requested?
|
||||||
|
|
||||||
|
attribute :quote_id, if: -> { object.quote? }
|
||||||
|
|
||||||
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 :media_attachments, serializer: REST::MediaAttachmentSerializer
|
has_many :media_attachments, serializer: REST::MediaAttachmentSerializer
|
||||||
has_many :ordered_mentions, key: :mentions
|
has_many :ordered_mentions, key: :mentions
|
||||||
@ -40,6 +41,10 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
|||||||
object.in_reply_to_account_id&.to_s
|
object.in_reply_to_account_id&.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def quote_id
|
||||||
|
object.quote_id.to_s
|
||||||
|
end
|
||||||
|
|
||||||
def current_user?
|
def current_user?
|
||||||
!current_user.nil?
|
!current_user.nil?
|
||||||
end
|
end
|
||||||
@ -168,3 +173,13 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class REST::NestedQuoteSerializer < REST::StatusSerializer
|
||||||
|
attribute :quote do
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class REST::StatusSerializer < ActiveModel::Serializer
|
||||||
|
belongs_to :quote, serializer: REST::NestedQuoteSerializer
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user