From c2cde41eb98a2a412bf0f5b7c32b076e9ddf14e4 Mon Sep 17 00:00:00 2001 From: Essem Date: Sun, 4 Aug 2024 19:13:04 -0500 Subject: [PATCH] Fix reblog reactions being hydrated improperly --- app/lib/status_cache_hydrator.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/lib/status_cache_hydrator.rb b/app/lib/status_cache_hydrator.rb index e3c9e49847..baeec20d52 100644 --- a/app/lib/status_cache_hydrator.rb +++ b/app/lib/status_cache_hydrator.rb @@ -32,7 +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) + payload[:reactions] = serialized_reactions(account_id, @status) if payload[:poll] 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][: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) + payload[:reblog][:reactions] = serialized_reactions(account_id, @status.reblog) if payload[:reblog][:poll] if @status.reblog.account_id == account_id @@ -73,7 +73,6 @@ class StatusCacheHydrator payload[:favourited] = payload[:reblog][:favourited] payload[:reblogged] = payload[:reblog][:reblogged] - payload[:reactions] = payload[:reblog][:reactions] end end @@ -90,8 +89,8 @@ class StatusCacheHydrator ).as_json end - def serialized_reactions(account_id) - reactions = @status.reactions(account_id) + def serialized_reactions(account_id, status) + reactions = status.reactions(account_id) ActiveModelSerializers::SerializableResource.new( reactions, each_serializer: REST::ReactionSerializer,