|
|
|
@ -32,6 +32,7 @@ class StatusCacheHydrator
|
|
|
|
|
payload[:bookmarked] = Bookmark.exists?(account_id: account_id, status_id: @status.id)
|
|
|
|
|
payload[:pinned] = StatusPin.exists?(account_id: account_id, status_id: @status.id) if @status.account_id == account_id
|
|
|
|
|
payload[:filtered] = mapped_applied_custom_filter(account_id, @status)
|
|
|
|
|
payload[:reactions] = serialized_reactions(account_id)
|
|
|
|
|
|
|
|
|
|
if payload[:poll]
|
|
|
|
|
payload[:poll][:voted] = @status.account_id == account_id
|
|
|
|
@ -57,6 +58,7 @@ class StatusCacheHydrator
|
|
|
|
|
payload[:reblog][:bookmarked] = Bookmark.exists?(account_id: account_id, status_id: @status.reblog_of_id)
|
|
|
|
|
payload[:reblog][:pinned] = StatusPin.exists?(account_id: account_id, status_id: @status.reblog_of_id) if @status.reblog.account_id == account_id
|
|
|
|
|
payload[:reblog][:filtered] = payload[:filtered]
|
|
|
|
|
payload[:reblog][:reactions] = serialized_reactions(account_id)
|
|
|
|
|
|
|
|
|
|
if payload[:reblog][:poll]
|
|
|
|
|
if @status.reblog.account_id == account_id
|
|
|
|
@ -71,6 +73,7 @@ class StatusCacheHydrator
|
|
|
|
|
|
|
|
|
|
payload[:favourited] = payload[:reblog][:favourited]
|
|
|
|
|
payload[:reblogged] = payload[:reblog][:reblogged]
|
|
|
|
|
payload[:reactions] = payload[:reblog][:reactions]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -87,6 +90,16 @@ class StatusCacheHydrator
|
|
|
|
|
).as_json
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def serialized_reactions(account_id)
|
|
|
|
|
reactions = @status.reactions(account_id)
|
|
|
|
|
ActiveModelSerializers::SerializableResource.new(
|
|
|
|
|
reactions,
|
|
|
|
|
each_serializer: REST::ReactionSerializer,
|
|
|
|
|
scope: account_id, # terrible
|
|
|
|
|
scope_name: :current_user
|
|
|
|
|
).as_json
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def payload_application
|
|
|
|
|
@status.application.present? ? serialized_status_application_json : nil
|
|
|
|
|
end
|
|
|
|
|