Commit 3cf262c7 authored by 2458773093's avatar 2458773093

relationship presenter + serializer updated for quotes

parent 12504c4f
......@@ -11,7 +11,7 @@ class StatusRelationshipsPresenter
@pins_map = {}
else
statuses = statuses.compact
status_ids = statuses.flat_map { |s| [s.id, s.reblog_of_id] }.uniq.compact
status_ids = statuses.flat_map { |s| [s.id, s.reblog_of_id, s.quote_of_id] }.uniq.compact
conversation_ids = statuses.map(&:conversation_id).compact.uniq
pinnable_status_ids = statuses.map(&:proper).select { |s| s.account_id == current_account_id && %w(public unlisted).include?(s.visibility) }.map(&:id)
......
......@@ -4,7 +4,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
attributes :id, :created_at, :in_reply_to_id, :in_reply_to_account_id,
:sensitive, :spoiler_text, :visibility, :language,
:uri, :url, :replies_count, :reblogs_count,
:favourites_count
:favourites_count, :quote_of_id
attribute :favourited, if: :current_user?
attribute :reblogged, if: :current_user?
......@@ -15,6 +15,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
attribute :text, if: :source_requested?
belongs_to :reblog, serializer: REST::StatusSerializer
belongs_to :quote, serializer: REST::StatusSerializer
belongs_to :application, if: :show_application?
belongs_to :account, serializer: REST::AccountSerializer
belongs_to :group, serializer: REST::GroupSerializer
......@@ -39,6 +40,10 @@ class REST::StatusSerializer < ActiveModel::Serializer
object.in_reply_to_account_id&.to_s
end
def quote_of_id
object.quote_of_id&.to_s
end
def current_user?
!current_user.nil?
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment