From fadf1676304f5c94cbca5b104320758c03e9178a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 11 Apr 2025 18:12:52 +0200 Subject: [PATCH] Avoid needing to pass an extra variable to the reactions partial Thanks to inverse_of, there's no extra query getting the comment from the reaction. --- app/views/cards/comments/reactions/_reaction.html.erb | 2 +- app/views/cards/comments/reactions/_reactions.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/cards/comments/reactions/_reaction.html.erb b/app/views/cards/comments/reactions/_reaction.html.erb index 61a799e32..2449ca997 100644 --- a/app/views/cards/comments/reactions/_reaction.html.erb +++ b/app/views/cards/comments/reactions/_reaction.html.erb @@ -12,7 +12,7 @@ class: [ "txt-small", { "txt-medium": reaction.all_emoji? } ], data: { action: "click->reaction-delete#reveal keydown.enter->reaction-delete#reveal:prevent", reaction_delete_target: "content" } %> - <%= button_to card_comment_reaction_path(comment.card, comment, reaction), + <%= button_to card_comment_reaction_path(reaction.comment.card, reaction.comment, reaction), method: :delete, class: "btn btn--negative flex-item-justify-end reaction__delete", data: { action: "reaction-delete#perform", reaction_delete_target: "button" } do %> diff --git a/app/views/cards/comments/reactions/_reactions.html.erb b/app/views/cards/comments/reactions/_reactions.html.erb index 0e53e817b..0aee3ce66 100644 --- a/app/views/cards/comments/reactions/_reactions.html.erb +++ b/app/views/cards/comments/reactions/_reactions.html.erb @@ -1,7 +1,7 @@ <%= turbo_frame_tag comment, :reactions do %>
- <%= render partial: "cards/comments/reactions/reaction", collection: comment.reactions.ordered, locals: { comment: comment } %> + <%= render partial: "cards/comments/reactions/reaction", collection: comment.reactions.ordered %>
<%= turbo_frame_tag comment, :new_reaction do %>