block / block/buzz

Desktop: buzz://message deep links into forum channels open the post list, never the post

Open
#7,315 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

`buzz://message` deep links into a **forum** channel open the post list and never select the post. The message is unreachable from its own "Copy link".

All citations at `origin/main` = `2ac0aa1dd`.

> **Correction (edited).** The first version of this issue cited `7e34bee62`, which is 17 commits stale on these files, and claimed two additional defects that #5889 (`207154706`, "fix(desktop): support channel message path links") had already fixed. Those claims are withdrawn — see "Already fixed" below. The forum defect is unaffected and verified to persist on current `main`.

## The canonical format works — for stream channels only

`buzz://message?channel=&id=[&thread=]` is parsed, validated, and dispatched by the `Some("message")` arm at `desktop/src-tauri/src/deep_link.rs:675`, then routed by `desktop/src/shared/useMessageDeepLinks.ts:20-45`. For stream channels this is correct: root links open the reply panel, reply links open and scroll it (`desktop/src/features/channels/ui/useChannelRouteTarget.ts`).

## The defect

Deep links call `goChannel` unconditionally and never `goForumPost`:

```ts
// desktop/src/shared/useMessageDeepLinks.ts:35-38
return goChannel(payload.channelId, {
messageId: payload.messageId,
threadRootId: payload.threadRootId,
});
```

The `/channels/$channelId` route it lands on is structurally incapable of selecting a forum post:

1. `desktop/src/app/routes/channels.$channelId.tsx:83,85` hardcode `selectedPostId={null}` and `targetReplyId={null}`
2. `desktop/src/features/channels/ui/useChannelRouteTarget.ts:109` returns early, before any thread handling, when `activeChannel.channelType === "forum"`

So a deep link to a forum post or comment lands on the channel's post list with nothing selected, regardless of `thread=`. The in-app markdown handler has the same gap — `desktop/src/shared/ui/markdown.tsx:1711-1716` also routes every message link through `goChannel`.

The route that *would* work already exists and is never used by deep links: `/channels/$channelId/posts/$postId?replyId=…` passes `selectedPostId={postId}`.

## In-repo precedent for the fix

Search already solves exactly this. `openSearchHitWithNavigation` resolves a destination first and branches to `goForumPost` for forum targets — `desktop/src/app/navigation/searchHitNavigation.ts:30,59-60`, with the resolver at `desktop/src/app/navigation/resolveSearchHitDestination.ts`, which fetches the event and derives `postId` from `getThreadReference(event.tags)` for `KIND_FORUM_COMMENT`.

Suggested fix: a `resolveMessageLinkDestination(channelId, messageId, threadRootId)` mirroring that kind-based branching, consumed by both `useMessageDeepLinks.ts` and the markdown handler.

## Two stale comments to correct in the same change

Both assert the current behaviour is fine. Both are wrong, and they are why this gap is easy to miss:

- `desktop/src/features/messages/lib/messageLink.ts:17-21` — says `threadRootId` is "not consumed by the click handler or deep-link listener". Both consume it.
- `desktop/src/shared/useMessageDeepLinks.ts:16-18` — says routing via `goChannel` "works for both stream replies and forum threads". It does not work for forum threads; that is this issue.

## Already fixed by #5889 — not part of this issue

Recorded so the next reader doesn't re-report them against an old build:

- **Cold-start race** — handled by the durable `PendingNavigationDeepLinks` pull-queue (`deep_link.rs:34`) plus `listenForNavigationDeepLinks` on the TS side.
- **Path-style `buzz://channel//<64-hex-id>`** — accepted as a compatibility form with window activation (`deep_link.rs:661`).

A released 0.5.11 predates #5889, which is why the original reporter saw "Buzz opens but doesn't navigate."

## Adjacent, not in scope

`ReminderDestination` is channel-only (`desktop/src/features/reminders/lib/reminderNavigation.ts`), so a reminder on a forum comment fails the same way. Same root cause, separate fix.

## Verification

`cargo test --manifest-path desktop/src-tauri/Cargo.toml deep_link` at `2ac0aa1dd`: 50 passed, 0 failed. No test covers a forum-channel message deep link.

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.