Fix boost button appearing prematurely on draft cards
When updating a draft card (e.g., adding a background image), the turbo stream response was using the published card container partial, which includes the reactions/boost button. Draft cards should use the draft container partial which intentionally omits reactions. Fixes https://app.fizzy.do/5986089/cards/3970
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<%= turbo_stream.replace dom_id(@card, :card_container), partial: "cards/container", method: :morph, locals: { card: @card.reload } %>
|
||||
<% container_partial = @card.drafted? ? "cards/drafts/container" : "cards/container" %>
|
||||
<%= turbo_stream.replace dom_id(@card, :card_container), partial: container_partial, method: :morph, locals: { card: @card.reload } %>
|
||||
|
||||
<%= turbo_stream.update dom_id(@card, :edit) do %>
|
||||
<%= render "cards/container/content_display", card: @card %>
|
||||
|
||||
@@ -76,6 +76,17 @@ class CardsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_equal "Something more in-depth", card.description.to_plain_text.strip
|
||||
end
|
||||
|
||||
test "update draft card does not render reactions" do
|
||||
draft = boards(:writebook).cards.create!(creator: users(:kevin), status: :drafted)
|
||||
|
||||
patch card_path(draft), as: :turbo_stream, params: {
|
||||
card: { image: fixture_file_upload("moon.jpg", "image/jpeg") }
|
||||
}
|
||||
assert_response :success
|
||||
|
||||
assert_no_match "reactions", response.body, "Draft card should not show reactions/boost button"
|
||||
end
|
||||
|
||||
test "users can only see cards in boards they have access to" do
|
||||
get card_path(cards(:logo))
|
||||
assert_response :success
|
||||
|
||||
Reference in New Issue
Block a user