block / block/buzz

feat(pulse): rich link previews on Pulse notes (parity with channel messages)

Open
#7,035 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
32.7k
Forks
4.3k
Avg merge
1d 13h
Merged PRs (30d)
253

Description

**Motivation**

Channel messages (kind 9) have had rich link previews since v0.5.6 (#3818): the sender's client fetches OpenGraph metadata, uploads the sanitized image to the relay media store, and embeds `["link-preview","snapshot",…]` tags on the event; recipients render the card from those tags and never contact external sites.

Pulse notes (kind 1) have no equivalent:

- `build_note` in `desktop/src-tauri/src/events.rs` accepts only content / reply / mentions / media tags — there is no link-preview path, unlike `build_message` which goes through `link_preview_tags::append`.
- `publishNote` (`desktop/src/shared/api/social.ts`) exposes no preview parameters.
- `NoteCard.tsx` renders `` with no preview-attachment rendering.

Net effect: the same link pasted in a channel produces a rich image card, but posted to Pulse — the surface whose whole job is sharing web content — it's a bare link. This also means the Pulse composer, which reuses `ForumComposer`, silently throws away any preview state the sender's client resolved.

**Proposed solution**

Reuse the existing messages pipeline end to end:

1. `build_note` gains a `link_preview_tags` parameter, validated by the same `link_preview_tags::append` (8-snapshot cap, relay-hosted `/media/` image/favicon pairs) used for kind 9.
2. `publishNote` accepts and forwards preview tags; the Pulse composer wires in the same `useComposerLinkPreviews` / `linkPreviewPreparationStore` machinery the channel composer already uses, including the `["link-preview","none"]` suppression marker.
3. `NoteCard.tsx` (desktop) renders snapshots through the existing `useMessageLinkPreviews` + card components.
4. Mobile degrades gracefully to a plain link, same as the entity-link v1 stance.

**Alternatives considered**

- *Attach the image as a media attachment (current workaround)* — clunky, loses title/description/favicon, duplicates bytes per note.
- *Relay-side unfurling* — conflicts with the shipped privacy model where only the sender's client fetches external sites.
- *Recipient-side fetch on render* — same conflict; the snapshot-tag design exists precisely to avoid this.

**Additional context**

Verified against `main` at desktop-v0.5.20 (local 0.5.19). Supporting references: `desktop/src/shared/lib/linkPreviewSnapshot.ts`, `desktop/src-tauri/src/commands/link_preview.rs` (OG/oEmbed fetch, size limits), `desktop/src/features/pulse/hooks.ts`. If #6624 lands `--tag` support on `messages send`, a matching parameter on `buzz social publish` would give CLI/agent-authored notes the same capability.

Searched open issues and PRs for duplicates — closest are #3369 (inline OG previews, channel-scoped) and #6624 (CLI snapshot tags for `messages send`). No existing issue or PR requests previews on Pulse notes: none found.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.