From 81215a593b8362c667122ae42eb201786f9c4e33 Mon Sep 17 00:00:00 2001 From: Rob Zolkos Date: Fri, 17 Apr 2026 09:06:17 -0400 Subject: [PATCH] Return the updated comment on PUT /:account_slug/cards/:card_number/comments/:comment_id The JSON response was `204 No Content`, which conflicted with both the API docs ("Returns the updated comment") and the Smithy contract the SDKs are generated from (`UpdateCommentResponseContent`). Render `show` for the JSON format so PUT returns the same payload as GET. The Turbo Stream format is unchanged. Docs already describe the correct response shape, so no doc change is needed here. Tests now assert the returned body content. --- app/controllers/cards/comments_controller.rb | 2 +- test/controllers/cards/comments_controller_test.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/controllers/cards/comments_controller.rb b/app/controllers/cards/comments_controller.rb index 7aed33c8c8..2243c1bdb4 100644 --- a/app/controllers/cards/comments_controller.rb +++ b/app/controllers/cards/comments_controller.rb @@ -30,7 +30,7 @@ def update respond_to do |format| format.turbo_stream - format.json { head :no_content } + format.json { render :show } end end diff --git a/test/controllers/cards/comments_controller_test.rb b/test/controllers/cards/comments_controller_test.rb index 5cebe22dea..3e311ae203 100644 --- a/test/controllers/cards/comments_controller_test.rb +++ b/test/controllers/cards/comments_controller_test.rb @@ -102,6 +102,10 @@ class Cards::CommentsControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_equal "Flat update", comment.reload.body.to_plain_text + + json = @response.parsed_body + assert_equal comment.id, json["id"] + assert_equal "Flat update", json["body"]["plain_text"] end test "update as JSON" do @@ -111,6 +115,11 @@ class Cards::CommentsControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_equal "Updated comment", comment.reload.body.to_plain_text + + json = @response.parsed_body + assert_equal comment.id, json["id"] + assert_equal "Updated comment", json["body"]["plain_text"] + assert_equal comment.creator.id, json["creator"]["id"] end test "edit a comment that contains a mention" do