Return updated user on PUT /users/:id#2853
Open
robzolkos wants to merge 2 commits intobasecamp:mainfrom
Open
Conversation
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.
Contributor
There was a problem hiding this comment.
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#updateto render theshowJSON 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 OKresponse 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The JSON response for
PUT /:account_slug/users/:user_idwas204 No Content, forcing clients to follow up with aGET. The Smithy contract that the SDKs are generated from already declaresUpdateUserreturns a User, so the server was out of sync with the documented shape.Rendering the
showtemplate on the JSON path makes the update return the same payload asGET /:account_slug/users/:user_id. The HTML redirect is unchanged.This endpoint only accepts
nameandavatar— 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.rb—format.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 bodydocs/api/sections/users.md— replaced "Returns 204 No Content" with the 200 response shapeMobile App check
PUT /users/:id/users/:idas this JSON update endpoint; it is only used for navigation/web routes204 No Contentto200 OKwith the updated user