feat(composer): add per-link preview controls - #4258
Draft
tellaho wants to merge 1 commit into
Draft
Conversation
Co-authored-by: Taylor Ho <taylorkmho@gmail.com> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
tellaho
force-pushed
the
tho/per-link-preview-controls
branch
from
August 2, 2026 05:34
62e051f to
3f21a71
Compare
|
Re-validated the branch end-to-end against current
Every gate listed in the PR's own validation block passes on this checkout. No further changes needed from my side — ready for review. Attempted to flip the PR from draft → ready-for-review but |
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.
Category: new-feature
User Impact: Authors can review and remove individual link previews before sending while keeping the links in their message.
Problem: Link previews only appeared after send, and authors could only remove every preview at once. Solution: Resolve previews inside new and edit composers, persist canonical per-URL suppression through drafts and events, and apply the same controls across optimistic, timeline, and forum rendering without blocking Send.
File changes
desktop/src-tauri/src/commands/messages.rs
Accept and validate per-link suppression on sends and edits.
desktop/src-tauri/src/events.rs, desktop/src-tauri/src/link_preview_tags.rs
Build canonical suppression tags into message and edit events behind a strict HTTPS-only validator.
desktop/src-tauri/src/egress_guard_tests.rs, desktop/src-tauri/src/huddle/pipeline.rs, desktop/src-tauri/src/lib.rs
Wire the new builder argument through existing Rust callers and register the validator module.
desktop/src/features/channels/ui/ChannelPane.types.ts, desktop/src/features/channels/ui/ChannelScreen.tsx, desktop/src/features/channels/useChannelPaneHandlers.ts
Seed edit composers from effective event suppression and pass controls through send/edit handlers.
desktop/src/features/messages/hooks.ts, desktop/src/features/messages/ui/useMentionSendFlow.ts
Carry suppression through normal, mention-confirmed, optimistic, REST, and edit paths.
desktop/src/features/messages/lib/applyEditTagOverlay.mjs, desktop/src/features/messages/lib/applyEditTagOverlay.test.mjs, desktop/src/features/messages/lib/formatTimelineMessages.ts
Overlay URL-specific edit controls deterministically while preserving blanket suppression compatibility.
desktop/src/features/messages/lib/imetaMediaMarkdown.ts, desktop/src/features/messages/lib/imetaMediaMarkdown.test.mjs
Split preview-control tags from media, emoji, and mention tags for validated relay submission.
desktop/src/features/messages/lib/useDrafts.ts, desktop/src/features/messages/ui/useDraftPersistSnapshot.ts
Persist and restore per-draft suppression with backward-compatible migration.
desktop/src/features/messages/ui/MessageComposer.tsx, desktop/src/features/messages/ui/MessageComposer.types.ts, desktop/src/features/messages/ui/useComposerLinkPreviews.tsx
Render non-blocking previews before send and restore suppression correctly across draft and edit transitions.
desktop/src/features/messages/ui/MessageRow.tsx, desktop/src/shared/ui/link-preview-list.tsx, desktop/src/shared/ui/markdown.tsx, desktop/src/shared/ui/markdown/types.ts, desktop/src/shared/ui/markdownUtils.ts
Reuse existing preview cards for per-item removal and filter suppressed canonical URLs on rendered messages.
desktop/src/shared/api/editMessage.ts, desktop/src/shared/api/tauri.ts
Expose suppression fields through the desktop bridge.
desktop/src/shared/lib/linkPreviewSuppression.mjs, desktop/src/shared/lib/linkPreviewSuppression.d.mts, desktop/src/shared/lib/linkPreviewSuppression.test.mjs
Normalize fragments, deduplicate URLs, parse legacy controls, and build deterministic tags.
desktop/tests/e2e/messaging.spec.ts
Cover composer preview deduplication, canonical removal, retained text, and Compact/Rich display.
Reproduction steps
Validation
pnpm checkcargo test --workspace: 2,105 passed, 14 ignoredcargo clippy --all-targets -- -D warningsmessaging.spec.ts: 41 passedScreenshots
Compact
Rich after removing one preview