Add card reactions to API docs and reactions_url to card JSON (#2427)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,4 +20,5 @@ json.cache! card do
|
||||
json.has_more_assignees card.assignees.size > 5
|
||||
|
||||
json.comments_url card_comments_url(card)
|
||||
json.reactions_url card_reactions_url(card)
|
||||
end
|
||||
|
||||
+63
-2
@@ -553,7 +553,8 @@ __Response:__
|
||||
"created_at": "2025-12-05T19:36:35.401Z",
|
||||
"url": "http://fizzy.localhost:3006/897362094/users/03f5v9zjw7pz8717a4no1h8a7"
|
||||
},
|
||||
"comments_url": "http://fizzy.localhost:3006/897362094/cards/4/comments"
|
||||
"comments_url": "http://fizzy.localhost:3006/897362094/cards/4/comments",
|
||||
"reactions_url": "http://fizzy.localhost:3006/897362094/cards/4/reactions"
|
||||
},
|
||||
]
|
||||
```
|
||||
@@ -614,6 +615,7 @@ __Response:__
|
||||
"url": "http://fizzy.localhost:3006/897362094/users/03f5v9zjw7pz8717a4no1h8a7"
|
||||
},
|
||||
"comments_url": "http://fizzy.localhost:3006/897362094/cards/4/comments",
|
||||
"reactions_url": "http://fizzy.localhost:3006/897362094/cards/4/reactions",
|
||||
"steps": [
|
||||
{
|
||||
"id": "03f8huu0sog76g3s975963b5e",
|
||||
@@ -928,7 +930,66 @@ __Response:__
|
||||
|
||||
Returns `204 No Content` on success.
|
||||
|
||||
## Reactions
|
||||
## Card Reactions (Boosts)
|
||||
|
||||
Card reactions (also called "boosts") let users add short responses directly to cards. These are limited to 16 characters.
|
||||
|
||||
### `GET /:account_slug/cards/:card_number/reactions`
|
||||
|
||||
Returns a list of reactions on a card.
|
||||
|
||||
__Response:__
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": "03f5v9zo9qlcwwpyc0ascnikz",
|
||||
"content": "👍",
|
||||
"reacter": {
|
||||
"id": "03f5v9zjw7pz8717a4no1h8a7",
|
||||
"name": "David Heinemeier Hansson",
|
||||
"role": "owner",
|
||||
"active": true,
|
||||
"email_address": "david@example.com",
|
||||
"created_at": "2025-12-05T19:36:35.401Z",
|
||||
"url": "http://fizzy.localhost:3006/897362094/users/03f5v9zjw7pz8717a4no1h8a7"
|
||||
},
|
||||
"url": "http://fizzy.localhost:3006/897362094/cards/3/reactions/03f5v9zo9qlcwwpyc0ascnikz"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### `POST /:account_slug/cards/:card_number/reactions`
|
||||
|
||||
Adds a reaction (boost) to a card.
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `content` | string | Yes | The reaction text (max 16 characters) |
|
||||
|
||||
__Request:__
|
||||
|
||||
```json
|
||||
{
|
||||
"reaction": {
|
||||
"content": "Great 👍"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
__Response:__
|
||||
|
||||
Returns `201 Created` on success.
|
||||
|
||||
### `DELETE /:account_slug/cards/:card_number/reactions/:reaction_id`
|
||||
|
||||
Removes your reaction from a card. Only the reaction creator can remove their own reactions.
|
||||
|
||||
__Response:__
|
||||
|
||||
Returns `204 No Content` on success.
|
||||
|
||||
## Comment Reactions
|
||||
|
||||
Reactions are short (16-character max) responses to comments.
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@ class Cards::CommentsControllerTest < ActionDispatch::IntegrationTest
|
||||
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")
|
||||
assert_equal card_comment_reactions_url(comment.card_id, comment.id), @response.parsed_body["reactions_url"]
|
||||
assert_equal card_comment_url(comment.card_id, comment.id), @response.parsed_body["url"]
|
||||
end
|
||||
|
||||
test "update as JSON" do
|
||||
|
||||
@@ -161,6 +161,8 @@ class CardsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_equal card.title, @response.parsed_body["title"]
|
||||
assert_equal card.closed?, @response.parsed_body["closed"]
|
||||
assert_equal 2, @response.parsed_body["steps"].size
|
||||
assert_equal card_comments_url(card), @response.parsed_body["comments_url"]
|
||||
assert_equal card_reactions_url(card), @response.parsed_body["reactions_url"]
|
||||
end
|
||||
|
||||
test "create as JSON" do
|
||||
|
||||
Reference in New Issue
Block a user