Skip to content

Return updated user on PUT /users/:id#2853

Open
robzolkos wants to merge 2 commits intobasecamp:mainfrom
robzolkos:user-update-returns-body
Open

Return updated user on PUT /users/:id#2853
robzolkos wants to merge 2 commits intobasecamp:mainfrom
robzolkos:user-update-returns-body

Conversation

@robzolkos
Copy link
Copy Markdown
Collaborator

@robzolkos robzolkos commented Apr 17, 2026

Summary

The JSON response for PUT /:account_slug/users/:user_id was 204 No Content, forcing clients to follow up with a GET. The Smithy contract that the SDKs are generated from already declares UpdateUser returns a User, so the server was out of sync with the documented shape.

Rendering the show template on the JSON path makes the update return the same payload as GET /:account_slug/users/:user_id. The HTML redirect is unchanged.

This endpoint only accepts name and avatar — neither of which can revoke the acting user's access — so (unlike #2848 for boards) no access-check branch is needed.

Discovered during a fizzy-cli QA sweep — same class of issue as #2848, #2849, #2851, #2852.

Changes

  • app/controllers/users_controller.rbformat.json { head :no_content }format.json { render :show }
  • test/controllers/users_controller_test.rb — "update as JSON" test now asserts id and name on the returned body
  • docs/api/sections/users.md — replaced "Returns 204 No Content" with the 200 response shape

Mobile App check

  • Neither mobile app has native client code calling PUT /users/:id
  • Neither mobile app uses /users/:id as this JSON update endpoint; it is only used for navigation/web routes
  • Neither mobile app is affected by this response change from 204 No Content to 200 OK with the updated user

The JSON response was `204 No Content`, forcing clients to follow
up with a GET. The Smithy contract the SDKs are generated from
already declares `UpdateUser` returns a User, so the server was
out of sync with the documented shape.

Render `show` for the JSON format so PUT returns the same payload
as GET. The HTML redirect behavior is unchanged. Only name and
avatar are accepted on this endpoint, neither of which affects
the acting user's access, so no access-check branch is needed.

Updated test asserts the returned body matches the updated state.
Updated API docs to describe the 200 response shape.
Copilot AI review requested due to automatic review settings April 17, 2026 13:07
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR brings the PUT /:account_slug/users/:user_id JSON response in line with the Smithy contract and the existing GET shape by returning the updated user payload (instead of 204 No Content), eliminating the need for clients to do a follow-up GET after an update.

Changes:

  • Updated UsersController#update to render the show JSON template on successful JSON updates.
  • Updated the JSON controller test to assert the returned payload includes the updated user fields.
  • Updated the API docs to describe the 200 OK response with the updated user payload.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
app/controllers/users_controller.rb Returns the updated user payload on successful JSON updates by rendering :show.
test/controllers/users_controller_test.rb Updates the JSON update test to expect 200 and validate returned id/name.
docs/api/sections/users.md Documents the new 200 OK response behavior for user updates.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Mirrors the nested-params test in users_controller_test.rb — flat
JSON PUTs now return the updated user as the body instead of 204
No Content.
@robzolkos robzolkos requested a review from flavorjones April 17, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants