Open a user's profile popout with their banner #219

Manually merged
charles merged 0 commits from feat-user-profile into main 2026-11-12 05:19:47 +00:00
Owner

Stacked on: #214 (feat-entity-images). Merge that first; this branch starts from it.

Before this PR, clicking a user did nothing. The client had no profile popout at all, so a user's banner could not be seen.

What opens it

A left click opens the popout, as PreloadableUserPopout.tsx:241-269 does, on:

  • a member list row (MemberListItem.tsx:265-278);
  • a message author's avatar or name (MessageAvatar.tsx:57-68, MessageUsername.tsx:84-98);
  • a voice participant row in the sidebar (VoiceParticipantItem.tsx:332-344). A right click there still opens the participant menu.

The DM list does not open it, and neither does the original (DMListItem.tsx: a click navigates).

Placement follows PopoverPopouts.tsx:170 and useAntiShiftFloating.ts:305-311:

  • right-start, 8 px from the target;
  • flipped to left-start when it does not fit, which is what happens for the member list;
  • shifted inside the window by max(6, adaptive padding).

The target's bounds are reported in window coordinates, also from inside the scrolled lists (widgets::popout::trigger).

It closes on a click outside it, a click on the same target again, Escape, Message and Edit profile.

Request and response

GET /users/{id}/profile?guild_id=…&with_mutual_friends=true&with_mutual_guilds=true. guild_id is sent only in a guild, and the mutual flags are always sent, as UserProfileCommands.tsx:37-43 does.

The model is UserProfileResponse, built as the fork's getUserProfile builds it (UserAccountRequestService.ts:343-433, UserMappers.ts:215-284):

  • user;
  • user_profile {bio, pronouns, banner, banner_color, accent_color};
  • guild_member? and guild_member_profile? {bio, pronouns, banner, accent_color};
  • profile_badges, operator_pass_since, hidden_profile_badge_count?;
  • mutual_friends?, mutual_guilds?, connected_accounts?;
  • timezone_offset, profile_limited?.

Everything except user is read leniently. It is under the OpenAPI contract test (UserProfileFullResponse, ProfileBadgeResponse). The fixtures are synthetic.

Caching follows UserProfile.ts:

  • per user and guild, for 60 s;
  • requests already in flight are not repeated;
  • forgotten on READY, on guild create/delete and on member add/remove.

Message opens the existing DM, or calls POST /users/@me/channels {recipient_id} and opens the new channel (PrivateChannelCommands.ts:83-106).

What the popout shows

Card: 305 px wide (300 px content plus a 2.5 px accent border), 6 px radius, --background-primary.

  1. Banner, 105 px.
    • The member's per-guild banner first, otherwise the user's; none when the member has BANNER_UNSET.
    • Image sources: user banners banners/{user}/{hash}.webp?size=600, member banners guilds/{g}/users/{u}/banners/{hash}.webp?size=600.
    • Animated (a_) banners play while "Automatically play GIFs" is on, otherwise on hover.
    • Without a banner it is filled with the accent colour: the profile's accent_color, otherwise avatar_color, otherwise the default avatar's colour, otherwise #4641D9 (AccentColorUtils.ts:17-37). banner_color is not used, as in the original.
  2. Avatar, 80 px, in a 3.2 px ring at 10,55, with the presence dot. An animated avatar always plays.
  3. Names. Display name (nickname first) with the BOT tag, then username#discriminator. The discriminator is hidden only on instances with unique usernames (UserTagUtils.ts, read from the discovery document's features). Pronouns below.
  4. Bio: Markdown with RESTRICTED_USER_BIO flags, 14 px with 1.5 line height, at most 3 lines.
  5. Notices: "Unable to load profile banner, badges, and bio." after a failed fetch (the user object is still shown), or the limited-profile notice.
  6. Member since:
    • in a guild: the Fluxer mark with the account date and the guild icon with the join date;
    • otherwise: "Fluxer member since" with the account date.
    • Dates are formatted like Mar 4, 2024.
  7. Role pills, highest first, from RoleManagement.module.css.
  8. Footer button: "Message", or "Edit profile" on your own profile (opens Settings → My profile).

While nothing is cached, a skeleton is shown instead.

Left out (follow-ups)

  • #216: the full profile modal (avatar/name click, "View full profile", mutual friends and communities tabs, note editor).
  • #217: badges, custom status, voice activity, local time, connections, the note and copy-ID hover icons, the empty roles section and add-role button for moderators, blocked "Open DM".
  • #218: opening from mentions and reply previews, 220 ms hover prefetch, Shift+click to mention, user context menus, the slide-in animation, bio lists and spoilers, name size scaling with length.

No dead buttons: only Message and Edit profile are shown, and both work.

Refs #212. This PR adds user and member banners and the avatar_color accent. #212 stays open for the guild splash and the voice tile avatar_color background.

Devserver

  • GET /users/{id}/profile serves fixtures/rest/user_profile*.json with the server's rules: the member and member profile only for a guild the user is in, mutuals only when asked for and never on your own profile, 404 UNKNOWN_USER otherwise.
  • The fixture users cover three cases:
    • ada: a still banner plus a per-guild banner override and bio;
    • the signed-in user: an animated banner;
    • relay: colours only.
  • POST /users/@me/channels returns the existing DM, or creates one and sends CHANNEL_CREATE.
  • Member banner pictures are served at their real path.

Tests

  • proto: fixtures round-trip, the contract test, and lenient parts (a bad badge, member or member profile costs only that part).
  • api: wiremock tests for the query and for DM creation.
  • core (tests/profiles.rs): open/toggle, fetch once, 60 s cache, failure state, invalidation, overrides, accent colour priority, tags, dates, roles, Message with an existing DM and with a new one, Edit profile.
  • ui: placement (flip and shift), messages to actions, and the URLs the screen wants (member banner; animated banner and avatar).
  • devserver: profile shapes, banners, DM creation.
  • End to end (apps/fluxer/tests/profile.rs): open → the runtime's request → the popout view model with the member banner → the real ImageCache loads it from the devserver → Message creates and selects the DM.

Goldens

Two goldens were added; the existing ones are unchanged:

  • profile_popout_member.png: ada from the member list row, flipped left, with her member banner, bio, pronouns and both dates.
  • profile_popout_no_banner.png: relay from a message author, with the accent-colour banner and the BOT tag.

Rendered on lavapipe in the local fluxer-native-shots:u2204 image (Ubuntu 22.04). The host has no software Vulkan, so the host's 1.98.1 toolchain and cargo registry were mounted read-only into the container, with WGPU_BACKEND=vulkan and VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.x86_64.json:

  • cargo test -p fluxer-ui --test screenshots -- --ignored (UPDATE_GOLDEN=1 for the two new goldens);
  • all 14 then passed.

cargo xtask ci passes on the host; the screenshot step is not run there.

Check first on the real server

  1. The profile request succeeds for someone you share a guild with. The server answers 403 when you share nothing, and the popout then shows the failure warning.
  2. Banners: user banners at banners/{user}/… and member overrides at guilds/{g}/users/{u}/banners/…. Check that animated ones play when GIF autoplay is on.
  3. Whether the tag shows #discriminator: this depends on the instance's features.tag_style / account_identity.
  4. Message to someone you have no DM with yet creates and opens the DM.

🤖 Generated with Claude Code

Stacked on: #214 (`feat-entity-images`). Merge that first; this branch starts from it. Before this PR, clicking a user did nothing. The client had no profile popout at all, so a user's banner could not be seen. ## What opens it A **left click** opens the popout, as `PreloadableUserPopout.tsx:241-269` does, on: - a member list row (`MemberListItem.tsx:265-278`); - a message author's avatar or name (`MessageAvatar.tsx:57-68`, `MessageUsername.tsx:84-98`); - a voice participant row in the sidebar (`VoiceParticipantItem.tsx:332-344`). A right click there still opens the participant menu. The DM list does not open it, and neither does the original (`DMListItem.tsx`: a click navigates). **Placement** follows `PopoverPopouts.tsx:170` and `useAntiShiftFloating.ts:305-311`: - `right-start`, 8 px from the target; - flipped to `left-start` when it does not fit, which is what happens for the member list; - shifted inside the window by `max(6, adaptive padding)`. The target's bounds are reported in window coordinates, also from inside the scrolled lists (`widgets::popout::trigger`). It **closes** on a click outside it, a click on the same target again, Escape, Message and Edit profile. ## Request and response `GET /users/{id}/profile?guild_id=…&with_mutual_friends=true&with_mutual_guilds=true`. `guild_id` is sent only in a guild, and the mutual flags are always sent, as `UserProfileCommands.tsx:37-43` does. The model is `UserProfileResponse`, built as the fork's `getUserProfile` builds it (`UserAccountRequestService.ts:343-433`, `UserMappers.ts:215-284`): - `user`; - `user_profile {bio, pronouns, banner, banner_color, accent_color}`; - `guild_member?` and `guild_member_profile? {bio, pronouns, banner, accent_color}`; - `profile_badges`, `operator_pass_since`, `hidden_profile_badge_count?`; - `mutual_friends?`, `mutual_guilds?`, `connected_accounts?`; - `timezone_offset`, `profile_limited?`. Everything except `user` is read leniently. It is under the OpenAPI contract test (`UserProfileFullResponse`, `ProfileBadgeResponse`). The fixtures are synthetic. **Caching** follows `UserProfile.ts`: - per user and guild, for 60 s; - requests already in flight are not repeated; - forgotten on READY, on guild create/delete and on member add/remove. **Message** opens the existing DM, or calls `POST /users/@me/channels {recipient_id}` and opens the new channel (`PrivateChannelCommands.ts:83-106`). ## What the popout shows Card: 305 px wide (300 px content plus a 2.5 px accent border), 6 px radius, `--background-primary`. 1. **Banner**, 105 px. - The member's per-guild banner first, otherwise the user's; none when the member has `BANNER_UNSET`. - Image sources: user banners `banners/{user}/{hash}.webp?size=600`, member banners `guilds/{g}/users/{u}/banners/{hash}.webp?size=600`. - Animated (`a_`) banners play while "Automatically play GIFs" is on, otherwise on hover. - Without a banner it is filled with the **accent colour**: the profile's `accent_color`, otherwise `avatar_color`, otherwise the default avatar's colour, otherwise `#4641D9` (`AccentColorUtils.ts:17-37`). `banner_color` is not used, as in the original. 2. **Avatar**, 80 px, in a 3.2 px ring at 10,55, with the presence dot. An animated avatar always plays. 3. **Names.** Display name (nickname first) with the BOT tag, then `username#discriminator`. The discriminator is hidden only on instances with unique usernames (`UserTagUtils.ts`, read from the discovery document's `features`). Pronouns below. 4. **Bio**: Markdown with `RESTRICTED_USER_BIO` flags, 14 px with 1.5 line height, at most 3 lines. 5. **Notices**: "Unable to load profile banner, badges, and bio." after a failed fetch (the user object is still shown), or the limited-profile notice. 6. **Member since**: - in a guild: the Fluxer mark with the account date and the guild icon with the join date; - otherwise: "Fluxer member since" with the account date. - Dates are formatted like `Mar 4, 2024`. 7. **Role pills**, highest first, from `RoleManagement.module.css`. 8. **Footer button**: "Message", or "Edit profile" on your own profile (opens Settings → My profile). While nothing is cached, a skeleton is shown instead. ## Left out (follow-ups) - #216: the **full profile modal** (avatar/name click, "View full profile", mutual friends and communities tabs, note editor). - #217: badges, custom status, voice activity, local time, connections, the note and copy-ID hover icons, the empty roles section and add-role button for moderators, blocked "Open DM". - #218: opening from mentions and reply previews, 220 ms hover prefetch, Shift+click to mention, user context menus, the slide-in animation, bio lists and spoilers, name size scaling with length. No dead buttons: only Message and Edit profile are shown, and both work. Refs #212. This PR adds user and member banners and the `avatar_color` accent. #212 stays open for the guild splash and the voice tile `avatar_color` background. ## Devserver - `GET /users/{id}/profile` serves `fixtures/rest/user_profile*.json` with the server's rules: the member and member profile only for a guild the user is in, mutuals only when asked for and never on your own profile, `404 UNKNOWN_USER` otherwise. - The fixture users cover three cases: - ada: a still banner plus a per-guild banner override and bio; - the signed-in user: an animated banner; - relay: colours only. - `POST /users/@me/channels` returns the existing DM, or creates one and sends `CHANNEL_CREATE`. - Member banner pictures are served at their real path. ## Tests - **proto**: fixtures round-trip, the contract test, and lenient parts (a bad badge, member or member profile costs only that part). - **api**: wiremock tests for the query and for DM creation. - **core** (`tests/profiles.rs`): open/toggle, fetch once, 60 s cache, failure state, invalidation, overrides, accent colour priority, tags, dates, roles, Message with an existing DM and with a new one, Edit profile. - **ui**: placement (flip and shift), messages to actions, and the URLs the screen wants (member banner; animated banner and avatar). - **devserver**: profile shapes, banners, DM creation. - **End to end** (`apps/fluxer/tests/profile.rs`): open → the runtime's request → the popout view model with the member banner → the real `ImageCache` loads it from the devserver → Message creates and selects the DM. ## Goldens Two goldens were added; the existing ones are unchanged: - `profile_popout_member.png`: ada from the member list row, flipped left, with her member banner, bio, pronouns and both dates. - `profile_popout_no_banner.png`: relay from a message author, with the accent-colour banner and the BOT tag. Rendered on lavapipe in the local `fluxer-native-shots:u2204` image (Ubuntu 22.04). The host has no software Vulkan, so the host's 1.98.1 toolchain and cargo registry were mounted read-only into the container, with `WGPU_BACKEND=vulkan` and `VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.x86_64.json`: - `cargo test -p fluxer-ui --test screenshots -- --ignored` (`UPDATE_GOLDEN=1` for the two new goldens); - all 14 then passed. `cargo xtask ci` passes on the host; the screenshot step is not run there. ## Check first on the real server 1. The profile request succeeds for someone you share a guild with. The server answers 403 when you share nothing, and the popout then shows the failure warning. 2. Banners: user banners at `banners/{user}/…` and member overrides at `guilds/{g}/users/{u}/banners/…`. Check that animated ones play when GIF autoplay is on. 3. Whether the tag shows `#discriminator`: this depends on the instance's `features.tag_style` / `account_identity`. 4. Message to someone you have no DM with yet creates and opens the DM. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Open a user's profile popout with their banner
All checks were successful
ci / Windows (x64) (push) Successful in 16m12s
ci / Linux (x86_64) (push) Successful in 36m51s
12f4ce1c53
Clicking a user did nothing: there was no profile popout. Now a left
click on a member list row, a message author's avatar or name, or a
voice participant row opens the web app's profile card beside it.

- fluxer-proto: UserProfileResponse (GET /users/{id}/profile, shaped as
  the fork's getUserProfile builds it, lenient everywhere but `user`),
  UserProfileQuery, CreateDmRequest; WellKnown::features with
  uses_unique_usernames(). Fixtures user_profile*.json.
- fluxer-api: user_profile(), create_dm().
- fluxer-core: Profiles (open popout with its anchor, fetch with
  guild_id and the mutual flags, 60 s cache, forgotten on READY and
  guild/member changes), MessageUser (existing DM or POST
  /users/@me/channels), user and member banner URLs, and the
  selectors::profile view model (overrides, BANNER_UNSET/AVATAR_UNSET,
  accent colour priority, tag, dates, roles, footer action).
- fluxer-ui: widgets::popout (trigger with window bounds inside
  scrolled lists; right-start placement with flip and shift as Floating
  UI does), screens::main::profile_popout (305 px card, banner with the
  GIF rule, always-animated 80 px avatar, names, pronouns, bio with the
  bio Markdown flags, member since, role pills, Message/Edit profile,
  skeleton and failure warning), Escape and click-outside to close.
- fluxer-devserver: the profile endpoint and DM creation; member
  banner pictures.
- apps/fluxer: run the two requests; end-to-end test.
- Goldens profile_popout_member and profile_popout_no_banner (lavapipe,
  Ubuntu 22.04).

Refs #212

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
charles referenced this pull request from a commit 2026-11-12 05:19:36 +00:00
charles manually merged commit 1cd9adc7c4 into main 2026-11-12 05:19:47 +00:00
Sign in to join this conversation.
No description provided.