relationship presenter + serializer updated for quotes
This commit is contained in:
parent
12504c4f34
commit
3cf262c79b
@ -11,7 +11,7 @@ class StatusRelationshipsPresenter
|
|||||||
@pins_map = {}
|
@pins_map = {}
|
||||||
else
|
else
|
||||||
statuses = statuses.compact
|
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
|
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)
|
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,
|
attributes :id, :created_at, :in_reply_to_id, :in_reply_to_account_id,
|
||||||
:sensitive, :spoiler_text, :visibility, :language,
|
:sensitive, :spoiler_text, :visibility, :language,
|
||||||
:uri, :url, :replies_count, :reblogs_count,
|
:uri, :url, :replies_count, :reblogs_count,
|
||||||
:favourites_count
|
:favourites_count, :quote_of_id
|
||||||
|
|
||||||
attribute :favourited, if: :current_user?
|
attribute :favourited, if: :current_user?
|
||||||
attribute :reblogged, if: :current_user?
|
attribute :reblogged, if: :current_user?
|
||||||
@ -15,6 +15,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
|||||||
attribute :text, if: :source_requested?
|
attribute :text, if: :source_requested?
|
||||||
|
|
||||||
belongs_to :reblog, serializer: REST::StatusSerializer
|
belongs_to :reblog, serializer: REST::StatusSerializer
|
||||||
|
belongs_to :quote, 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 :group, serializer: REST::GroupSerializer
|
belongs_to :group, serializer: REST::GroupSerializer
|
||||||
@ -39,6 +40,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_of_id
|
||||||
|
object.quote_of_id&.to_s
|
||||||
|
end
|
||||||
|
|
||||||
def current_user?
|
def current_user?
|
||||||
!current_user.nil?
|
!current_user.nil?
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user