Merge pull request #2719 from basecamp/fix-card-view-m-hotkey

Fix card view M hotkey using stale user from fragment cache
This commit is contained in:
Mike Dalessio
2026-03-17 14:54:23 -04:00
committed by GitHub
2 changed files with 11 additions and 2 deletions
@@ -12,8 +12,8 @@
</span>
</button>
<% if Current.user && !local_assigns[:preview] %>
<%= button_to "Assign to me", card_assignments_path(card, params: { assignee_id: Current.user.id }), method: :post, data: {controller: "hotkey", action: "keydown.m@document->hotkey#click" }, hidden: true %>
<% unless local_assigns[:preview] %>
<%= button_to "Assign to me", card_self_assignment_path(card), method: :post, data: {controller: "hotkey", action: "keydown.m@document->hotkey#click" }, hidden: true %>
<% end %>
<dialog class="popup panel flex-column align-start gap-half fill-white shadow" data-dialog-target="dialog" data-action="turbo:before-morph-attribute->dialog#preventCloseOnMorphing turbo:submit-end->dialog#close">
@@ -42,6 +42,15 @@ class CardsControllerTest < ActionDispatch::IntegrationTest
assert_redirected_to card_draft_path(card)
end
test "show renders assign-to-me hotkey using self assignment path" do
card = cards(:logo)
get card_path(card)
assert_response :success
assert_select "form[action=?] button[hidden]", card_self_assignment_path(card), text: "Assign to me"
end
test "show renders inline code in title" do
card = cards(:logo)
card.update_column :title, "Fix the `bug` in production"