feat(members): embed user objects in member list via with_user#30
Merged
Conversation
Add an opt-in `?with_user=true` query param to the member list and search endpoints. When set, each member carries its public `user` object, resolved for the whole page in a single batched query, so clients no longer have to fetch users one at a time after listing members. Default behavior is unchanged (no embedded `user`), and the embedded object is the PublicUser shape — sensitive fields (is_admin, mfa_enabled, disabled, flags) are stripped. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
?with_user=truequery param toGET /spaces/{space_id}/membersand/members/search. When set, each member in the response carries an embedded publicuserobject.WHERE id IN (...)query (db::users::get_users_by_ids) — no server-side N+1.userkey), so existing callers are unaffected.PublicUsershape — sensitive fields (is_admin,mfa_enabled,disabled,flags) are stripped.Why
The Flutter client (and any client) previously had to call
GET /users/{id}once per member after listing — up to ~100 parallel requests on a single space open, which collided with the REST rate limiter (each then 429-retried) and stalled the member roster / message-author resolution. The client'sAccordMembermodel already parses an embeddeduser, so this flag lets it skip the per-member fetch entirely.Test plan
cargo fmtcleancargo clippycleantests/http.rs::test_list_members_with_user_embeds_public_user— asserts the embed appears withwith_user=true, is absent by default, and leaks no sensitive fieldscargo test --test http --test e2e --test securitygreen (50 / 82 / 109)🤖 Generated with Claude Code