Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/views/cards/comments/_comment.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ json.cache! comment do

json.creator comment.creator, partial: "users/user", as: :user

json.card do
json.id comment.card_id
json.url card_url(comment.card_id)
end

json.reactions_url card_comment_reactions_url(comment.card_id, comment.id)
json.url card_comment_url(comment.card_id, comment.id)
end
8 changes: 8 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,10 @@ __Response:__
"created_at": "2025-12-05T19:36:35.401Z",
"url": "http://fizzy.localhost:3006/897362094/users/03f5v9zjw7pz8717a4no1h8a7"
},
"card": {
"id": "03f5v9zo9qlcwwpyc0ascnikz",
"url": "http://fizzy.localhost:3006/897362094/cards/03f5v9zo9qlcwwpyc0ascnikz"
},
"reactions_url": "http://fizzy.localhost:3006/897362094/cards/3/comments/03f5v9zo9qlcwwpyc0ascnikz/reactions",
"url": "http://fizzy.localhost:3006/897362094/cards/3/comments/03f5v9zo9qlcwwpyc0ascnikz"
}
Expand Down Expand Up @@ -826,6 +830,10 @@ __Response:__
"created_at": "2025-12-05T19:36:35.401Z",
"url": "http://fizzy.localhost:3006/897362094/users/03f5v9zjw7pz8717a4no1h8a7"
},
"card": {
"id": "03f5v9zo9qlcwwpyc0ascnikz",
"url": "http://fizzy.localhost:3006/897362094/cards/03f5v9zo9qlcwwpyc0ascnikz"
},
"reactions_url": "http://fizzy.localhost:3006/897362094/cards/3/comments/03f5v9zo9qlcwwpyc0ascnikz/reactions",
"url": "http://fizzy.localhost:3006/897362094/cards/3/comments/03f5v9zo9qlcwwpyc0ascnikz"
}
Expand Down
4 changes: 3 additions & 1 deletion test/controllers/cards/comments_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ class Cards::CommentsControllerTest < ActionDispatch::IntegrationTest
test "show as JSON" do
comment = comments(:logo_agreement_kevin)

get card_comment_path(cards(:logo), comment), as: :json
get card_comment_path(comment.card, comment), as: :json

assert_response :success
assert_equal comment.id, @response.parsed_body["id"]
assert_equal comment.card.id, @response.parsed_body.dig("card", "id")
assert_equal card_url(comment.card.id), @response.parsed_body.dig("card", "url")
end

test "update as JSON" do
Expand Down