Skip to content

feat(members): embed user objects in member list via with_user#30

Merged
krazyjakee merged 1 commit into
masterfrom
feat/members-embed-user
Jun 11, 2026
Merged

feat(members): embed user objects in member list via with_user#30
krazyjakee merged 1 commit into
masterfrom
feat/members-embed-user

Conversation

@krazyjakee

Copy link
Copy Markdown
Contributor

Summary

  • Adds an opt-in ?with_user=true query param to GET /spaces/{space_id}/members and /members/search. When set, each member in the response carries an embedded public user object.
  • Users for the whole page are resolved in a single batched WHERE id IN (...) query (db::users::get_users_by_ids) — no server-side N+1.
  • Default behavior is unchanged (no user key), so existing callers are unaffected.
  • The embedded object is the PublicUser shape — 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's AccordMember model already parses an embedded user, so this flag lets it skip the per-member fetch entirely.

Test plan

  • cargo fmt clean
  • cargo clippy clean
  • New tests/http.rs::test_list_members_with_user_embeds_public_user — asserts the embed appears with with_user=true, is absent by default, and leaks no sensitive fields
  • cargo test --test http --test e2e --test security green (50 / 82 / 109)

🤖 Generated with Claude Code

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>
@krazyjakee krazyjakee merged commit 4458444 into master Jun 11, 2026
3 checks passed
@krazyjakee krazyjakee deleted the feat/members-embed-user branch June 11, 2026 19:46
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.

1 participant