feat(ui): user profile hovercard on username hover (LC-298) #327
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lc-298-profile-hovercard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Hovering a message author's name shows a small profile hovercard: avatar, display name + @username, bot badge, live status + custom status, bio, and a Message action.
Changes
server/src/routes/users.rs:GET /users/{id}/hovercard(auth-gated). Loads the target; bio shown only for public profiles or to self/admin; the Message link (to/dm/{id}) shown only when a DM is permitted (not self; target public or an existing DM exists, viafind_dm_room), mirroringroutes::dm.server/src/views/hovercard.rs+server/templates/partials/hovercard.html(new): the card fragment (reusesavatar.htmlat a larger size).server/src/routes/mod.rs,server/src/views/mod.rs: register route + module.server/templates/room/message.html:data-lc-hovercard="{user_id}"on the User-actor author link.server/templates/layout.html: one delegated hover controller (mouseover/mouseout, 350ms open delay, body-appended#lc-hovercard, position + flip/clamp, keep-open-over-card, dismiss on leave/Esc/scroll, no cache).server/locales/{en,es}/partials.ftl:hovercard-message.Other surfaces (mention chips, sidebar peers) can opt in later by adding the
data-lc-hovercardattribute.Testing
just check,just fmt,just test,just test-saasall pass.server/tests/routes_hovercard.rs(6 tests): public card shows name/username/bio + Message link; private bio hidden from another member but shown to admin; self card has no Message link; unknown id 404; unauth 303.Not operator-visible (no env/config/contract change).
Hovering a message author's name now shows a small profile popover: avatar, display name + @username, a bot badge when applicable, live status + custom status, bio, and a Message action. A new GET /users/{id}/hovercard endpoint (auth-gated) renders the card. Bio is shown only for public profiles, or to the user themselves, or to an admin (matching the search_users privacy posture). The Message link (to /dm/{id}) appears only when a DM is actually permitted: not self, and the target is public or an existing DM already exists, mirroring what routes::dm allows so the button never leads to a rejection. The trigger is one delegated controller in layout.html (same pattern as the code-copy / spoiler IIFEs): mouseover/mouseout on [data-lc-hovercard], a 350ms open delay, a single body-appended #lc-hovercard popover positioned near the trigger and flipped/clamped to stay on-screen, kept open while the pointer is over the card, dismissed on leave / Esc / scroll. No caching, so status stays fresh. The message-row author link carries the attribute; other surfaces can opt in later by adding it. #LC-298 #LC-299 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>