Text chat 23: Embeds (#273) #320
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "textchat-23-ui-embeds"
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?
What this builds
Embeds under a message (spec §3.5, §9.3), cloned from
fluxer_app/src/features/channel/components/embeds/(ChannelEmbed.tsx,channel_embed/RichEmbed.tsx,BlueskyEmbed.tsx,EmbedParts.tsx,ChannelEmbedShared.ts,EmbedRenderUtils.ts,media/EmbedYouTube.tsx); dimensions fromChannelEmbed.module.css,EmbedYouTube.module.cssandMediaDimensionConfig.ts.widgets/message_content/embed.rs:models(&embeds, &Display)is the pure model. It drops duplicates by normalized URL, splits media-only embeds from cards (hasRichEmbedContent), and builds the rich card: bar colour (else--brand-primary-foreground), provider, author with its 24 px icon, title link, and a description that is Markdown only for rich and Bluesky embeds. It also lays out the field grid (field_rows: 12 columns, at most 3 inline fields per row), the 80 px thumbnail (promoted to large media for article/image), large media, a gallery of up to 10 images sharing a URL, and the footer with its 20 px icon and "Today at …". Cards are 432 px wide with large media, 516 px otherwise. Bluesky gets its own width rule, the engagement row as text and the quoted post. Unknown types render as a plain (non-Markdown) card.embed_media.rs: image, GIF, GIFV (the proxy's animated variant of the thumbnail), video poster with play, and the audio card.fitisfitMediaWithinBounds(400 x 300, tall videos 400 x 450). Thumbhash placeholders show until the image loads.youtube.rs: the poster with "Play video" and "Open in new tab".MANAGE_MESSAGESoutside DMs, while the row is hovered and "Show suppress embeds button" is on. It emitsUserAction::SuppressEmbeds { confirmed: false }, and the confirm is Text chat 15's.render_embedsand the message'sSUPPRESS_EMBEDSflag hide embeds. Withinline_embed_mediaoff, media-only embeds become their link and cards lose large media. A message that is only the link of its media-only embeds hides its text (shouldHideContent).UserAction::OpenUrl. A string that does not parse as a URL is dropped. Only http(s) URLs leave the store (existingopen_url). Images are requested throughmedia::wanted(the proxy at 2x the layout size).ArrowSquareOut(arrow-square-out-fill.svgfrom @phosphor-icons/react 2.1.10).Tests
crates/fluxer-ui/tests/embeds.rs:field_grid_rows,width_432_with_media_else_516,thumbnail_promoted_for_article_and_image,duplicate_embeds_dropped(with the 10-image gallery),markdown_only_in_rich,unknown_type_renders_as_link_card, a table testmalformed_embeds_never_panic(28 hostile embeds × 5 clocks; models, footer times and built views),suppress_x_only_for_author_or_mod(pure table and through the store), plusfixture_embeds_take_the_original_paths(every embed offixtures/rest/message_embeds.json),display_settings_apply,footer_time_is_relative,media_fits_the_original_boundsandembed_clicks_become_user_actions.embed_rich_fields,embed_article,embed_youtube,embed_gifv(intests/screenshots.rs, README table updated). They show #general of the basic scenario plus one message carrying the corresponding embed ofmessage_embeds.json. The external pictures are gradients. No Electron reference capture: dimensions come from the fork component and CSS files named above.cargo xtask cigreen on the host (Arch, NVIDIA). The--ignoredstep was run in two halves. The fluxer-ui screenshots (all 36 goldens) ran on lavapipe in the Ubuntu 22.04 CI image (fluxer-native-shots:u2204, offline with the host's cargo cache); the goldens were written there withUPDATE_GOLDEN=1. The other ignored workspace tests ran on the host. The whole workspace could not run in that container because webrtc-sys needs the network.FLUXER_DESKTOP_TESTS) tests in this task.Deviations from the plan
theme/icons.rsand the svg (the new icon, as every UI task does);screens/main/messages.rs(oneMessage::Embedvariant and its mapping toOpenUrl/SuppressEmbeds);screens/main/media.rs(the embeds' image URLs inwanted);widgets/mod.rs; READMEs.message_content/mod.rsis created here with only the embed modules. Text chat 22 creates the same file and also editsmessage_row.rs, so whichever merges second has a mechanical conflict.textchat. Until it lands, an embed gallery is a grid of square tiles and a click on an embed image does nothing: follow-up #319.EmbedMediaRendererdraws no audio).UserAction::OpenUrllike message links do. The check belongs in the store'sOpenUrlpath, which does not have it yet; nothing here bypasses it.||url||covering the embed) and Markdown spoilers inside embed text are not interactive yet: spoilers in embed text stay covered.M/D/YYYY, HH:MM(24-hour like the rest of the client).disabled_operations(SEND_MESSAGE) is not checked for the suppress X; the store has no such field yet.Closes #273
🤖 Generated with Claude Code
Independent review: Text chat 23 (Embeds), head
bcb0132Scope:
git diff 9fcc13d..origin/textchat-23-ui-embeds(fluxer-ui only:widgets/message_content/{mod,embed,embed_media,youtube}.rs,message_row.rs,screens/main/{messages,media}.rs,theme/icons.rsand its svg,tests/{embeds,screenshots}.rs, 4 goldens, READMEs).Plan tests (1): all 8 exist and assert the spec's values.
field_grid_rows(≤3 inline per row, 12-column spans 4/6/12),width_432_with_media_else_516,thumbnail_promoted_for_article_and_image(400x300),duplicate_embeds_dropped(normalized URL, unparsable URLs never merged, gallery ≤10),markdown_only_in_rich(rich and bluesky only),unknown_type_renders_as_link_card, themalformed_embeds_never_panictable (28 hostile embeds x 5 extreme clocks, models plus a headless view build),suppress_x_only_for_author_or_mod(pure and through the store). The 4 screenshots exist and are listed in docs/screenshots/README.md.Interfaces (2): everything in the Interfaces block is present. The suppress X emits
UserAction::SuppressEmbeds { confirmed: false }.render_embeds,SUPPRESS_EMBEDSandinline_embed_mediaare honoured. Theembed::Message::OpenUrllink path is the one Task 43 switches over (see finding 1).Invariants (3): no new dependency and no fluxer-core change. The UI does no new I/O: images go only through
Images/embed::wanted, and the thumbhash decode is pure. No fixture was added (the tests reusefixtures/rest/message_embeds.json). No URL, secret or path is logged. I checked the panic paths and found none:fitclamps zero and huge sizes, the slicing inengagementis guarded by ASCII checks,rgbdrops high bits, Bluesky nesting is bounded at depth 1, andfooter_timehandles out-of-range clocks.Review Focus 7 (4): covered by the fuzz-style table above.
Local gate (5):
FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciin a clean review worktree exited 0. All 4 embed goldens passed on this host.Findings
UserAction::OpenUrl, which only checks the http/https scheme. Nothing checks trusted domains yet. Spec §18.2.3 explicitly moves embed links to the warning modal in Task 43, so this is deferred and does not block.RenderCtx, so it sharesrevealed_spoilers. Revealing spoiler N of the message text also uncovers spoiler N of an embed description, and clicks on embed spoilers do nothing (Embed::Spoiler(_) => Vec::new()). This is cosmetic and needs a follow-up issue.is_mature(CONTAINS_EXPLICIT_MEDIA) is defined but never used. Spec §15 says NSFW-flagged media gets the spoiler cover, and embed media is currently drawn uncovered. It can wait for the spoiler-cover work of Text chat 22. It needs a follow-up issue linked from the PR.inline_embed_mediais off,hides_contentkeeps the message text, and the media-only embed also becomesEmbedModel::Link. A link-only message therefore shows the same URL twice. The original hides the content whateverinline_embed_mediais set to.screens/main/media.rs::wantedrebuilds embed models for every stored message of the open channel on each call, not only the visible rows. This only costs performance.disabled_operationsis not checked, and the gallery is a square grid until the mosaic lands. The mechanical conflict with Text chat 22 overmessage_content/mod.rsandmessage_row.rsis expected.Verdict: approve. There are no blocking findings and the local CI is green. Findings 2 and 3 should become
follow-upissues before merge.Independent review: Text chat 23 (Embeds), at
5560034(diff 188f780..origin/textchat-23-ui-embeds)Checked
field_grid_rows,width_432_with_media_else_516,thumbnail_promoted_for_article_and_image,duplicate_embeds_dropped,markdown_only_in_rich,unknown_type_renders_as_link_card, tablemalformed_embeds_never_panic(28 hostile embeds × 5 extreme clocks, model + footer time + view build) andsuppress_x_only_for_author_or_modall exist incrates/fluxer-ui/tests/embeds.rs. They assert the spec §3.5 values: 432/516 widths, 12-column grid with at most 3 inline fields per row, 80 px thumbnail, gallery of 10 or fewer, 400×300 media and 400×450 tall media. The four screenshotsembed_rich_fields,embed_article,embed_youtubeandembed_gifvhave goldens and pass. I comparedhasRichEmbedContent,embedAllowsMarkdown, thewww.youtube.comhost check andMAX_INLINE_PER_ROWwith the fork'sEmbedRenderUtils.ts,EmbedParts.tsxandChannelEmbed.tsx, and they match.UserAction::SuppressEmbeds { confirmed: false }, andrender_embeds/inline_embed_mediaare all present. No existing public interface is changed.fluxer-coreis untouched and no dependency is added.fluxer-uigains no I/O path: images go through the existingmedia::wanted/ImageLoader, and the thumbhash cache is in memory only. No new fixtures (it uses the existingmessage_embeds.json). No secrets, URLs or paths are logged. Server data: I found no panic path, because slicing inengagementis guarded by ASCII checks,fitclamps, andcard/is_duplicateindex only afterget.unknown_type_renders_as_link_card.FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciin a fresh review worktree: exit 0, no failures.Findings
message_row::estimate_heightbuilds the embed models withrender_embeds: true, inline_media: trueno matter what the user's settings or the message'sSUPPRESS_EMBEDSflag say. So suppressed or disabled embeds still add estimated height until the row is laid out. This only affects the estimate, not what is drawn.UserAction::OpenUrl→open_urlpath as Markdown links. That path filters to http(s) only and has no trusted-domain / "Leaving Fluxer" step yet. This is consistent with the base, and spec §18.2.3 assigns the switch to Text chat 43. Noting it only so that task covers embeds too.inline_embed_mediais off) and finding 5 (media::wantedbuilds embed models for every message in the open channel each time it runs) still have no issue. I suggest openingfollow-upissues for both, but neither blocks.Verdict: approve. No blocking findings, and local CI is green.