From 2ab563e06ccc37c41983a204b5fa908483cf119e Mon Sep 17 00:00:00 2001 From: Essem Date: Fri, 9 Feb 2024 17:37:08 -0600 Subject: [PATCH] Expose reaction ids --- app/serializers/rest/status_reaction_serializer.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/serializers/rest/status_reaction_serializer.rb b/app/serializers/rest/status_reaction_serializer.rb index cdf779f3a0..701c20dd95 100644 --- a/app/serializers/rest/status_reaction_serializer.rb +++ b/app/serializers/rest/status_reaction_serializer.rb @@ -5,7 +5,8 @@ class REST::StatusReactionSerializer < ActiveModel::Serializer attributes :name - attribute :me, if: :current_user? + attribute :id, unless: :no_id? + attribute :me, if: :current_user? # are this and count worth keeping? attribute :url, if: :custom_emoji? attribute :static_url, if: :custom_emoji? attribute :count, if: :respond_to_count? @@ -18,6 +19,10 @@ class REST::StatusReactionSerializer < ActiveModel::Serializer object.respond_to?(:count) end + def no_id? + object.id.nil? + end + def current_user? !current_user.nil? end