Skip to content

feat(messages): report messages to community moderators - #255

Open
kalvinnchau wants to merge 1 commit into
mainfrom
peon/report-message
Open

kalvinnchau wants to merge 1 commit into
mainfrom
peon/report-message

Conversation

@kalvinnchau

Copy link
Copy Markdown
Contributor

Adds "Report message" to the message overflow menu, matching Buzz desktop.

Change

  • ReportMessageDialog: category radio group (NIP-56 types) + optional note; submit disabled until a category is chosen; pending state blocks close; failure keeps the draft and shows an error for manual retry.
  • session.messages.report(messageId, type, note): builds a kind:1984 event (p = author, e = message id + type) from a loaded kind 9/40002/40008 target, signs and publishes through the session writer. Sign and publish each race a 10s deadline and session disposal, so a late signature never publishes. Unavailable when the writer does not advertise kind 1984.
  • No outbox and no plugin: reports are not persisted or retried automatically.
  • Own messages and read-only channels are reportable; membership rows and undelivered local messages are not.
  • ChannelTimeline/MessageRow: a row with an open report or its success notice is added to Virtua keepMounted, so scrolling it out of range does not drop the draft or pending result. Release is deferred one task so Base UI focus restoration lands on the menu trigger first.
  • Dev broker: accepts and validates kind 1984 on sign and publish (two target tags, known category, 32,000-byte UTF-8 note).

Tests

  • relay/report.test.ts: event shape, target/type validation, deadline on hung sign and hung publish.
  • ReportMessageDialog.test.tsx: submit/reject/retry/success, empty form on reopen, focus restored before pin release.
  • ChannelTimeline.report.test.tsx: mounted StrictMode timeline + row with a Virtua boundary mock; row survives eviction through held submit and notice, and is evicted after dismissal/cancel.
  • Broker API tests for kind 1984 validation.
  • Source-served E2E (Chromium → Vite → dev broker → local buzz-relay/Postgres) passed 15/15 on the pre-rebase tree; reports land in the moderation queue with no ordinary kind-1984 event.

Limitations

  • Packaged builds have no live signer yet (vite.config.ts, docs/status.md); NIP-07/Tauri signer paths are untested.
  • A lost ACK followed by manual retry can create a duplicate report.
  • Notes over 32,000 bytes get a generic error (no textarea limit).
  • A full pnpm test pass at this exact commit has not completed; the pre-rebase runs had load-related timeouts in unrelated tests.

Add a "Report message" action to the message overflow menu that signs and
publishes a NIP-56 kind:1984 report through the session writer with a 10s
deadline. No outbox and no plugin; failures keep the draft for manual retry.
Rows holding an open report or its notice stay mounted in the virtualized
timeline.

Co-authored-by: Kalvin Chau <kalvin@block.xyz>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
@kalvinnchau
kalvinnchau requested review from a team, comp615 and wesbillman as code owners September 25, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant