mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-26 05:31:36 +01:00
Fix reblog reactions being hydrated improperly
This commit is contained in:
parent
81609f09ba
commit
c2cde41eb9
1 changed files with 4 additions and 5 deletions
|
@ -32,7 +32,7 @@ class StatusCacheHydrator
|
||||||
payload[:bookmarked] = Bookmark.exists?(account_id: account_id, status_id: @status.id)
|
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[: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[:filtered] = mapped_applied_custom_filter(account_id, @status)
|
||||||
payload[:reactions] = serialized_reactions(account_id)
|
payload[:reactions] = serialized_reactions(account_id, @status)
|
||||||
|
|
||||||
if payload[:poll]
|
if payload[:poll]
|
||||||
payload[:poll][:voted] = @status.account_id == account_id
|
payload[:poll][:voted] = @status.account_id == account_id
|
||||||
|
@ -58,7 +58,7 @@ class StatusCacheHydrator
|
||||||
payload[:reblog][:bookmarked] = Bookmark.exists?(account_id: account_id, status_id: @status.reblog_of_id)
|
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][: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][:filtered] = payload[:filtered]
|
||||||
payload[:reblog][:reactions] = serialized_reactions(account_id)
|
payload[:reblog][:reactions] = serialized_reactions(account_id, @status.reblog)
|
||||||
|
|
||||||
if payload[:reblog][:poll]
|
if payload[:reblog][:poll]
|
||||||
if @status.reblog.account_id == account_id
|
if @status.reblog.account_id == account_id
|
||||||
|
@ -73,7 +73,6 @@ class StatusCacheHydrator
|
||||||
|
|
||||||
payload[:favourited] = payload[:reblog][:favourited]
|
payload[:favourited] = payload[:reblog][:favourited]
|
||||||
payload[:reblogged] = payload[:reblog][:reblogged]
|
payload[:reblogged] = payload[:reblog][:reblogged]
|
||||||
payload[:reactions] = payload[:reblog][:reactions]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -90,8 +89,8 @@ class StatusCacheHydrator
|
||||||
).as_json
|
).as_json
|
||||||
end
|
end
|
||||||
|
|
||||||
def serialized_reactions(account_id)
|
def serialized_reactions(account_id, status)
|
||||||
reactions = @status.reactions(account_id)
|
reactions = status.reactions(account_id)
|
||||||
ActiveModelSerializers::SerializableResource.new(
|
ActiveModelSerializers::SerializableResource.new(
|
||||||
reactions,
|
reactions,
|
||||||
each_serializer: REST::ReactionSerializer,
|
each_serializer: REST::ReactionSerializer,
|
||||||
|
|
Loading…
Reference in a new issue