Skip to content

fix(#280): align e/p tag report types with nip 56 standard values#287

Closed
DSanich wants to merge 2 commits into
divinevideo:mainfrom
DSanich:fix/280-align-e/p-tag-report-types-with-NIP-56-standard-values
Closed

fix(#280): align e/p tag report types with nip 56 standard values#287
DSanich wants to merge 2 commits into
divinevideo:mainfrom
DSanich:fix/280-align-e/p-tag-report-types-with-NIP-56-standard-values

Conversation

@DSanich
Copy link
Copy Markdown
Contributor

@DSanich DSanich commented Apr 28, 2026

Summary

  • Align report event e/p tag third values with NIP-56 standard report types.
  • Preserve app-level report categorization via existing NIP-32 L/l tags (social.nos.ontology, NS-*).
  • Add targeted tests for mapping correctness and report tag contract on kind 1984 events.

Problem

useReportContent() was writing app-level reasons (for example csam, sexual-content, harassment) directly into the e/p tag third element.

NIP-56 requires these values to be one of:
nudity, malware, profanity, illegal, spam, impersonation, other.

What Changed

  • Added an explicit mapping from ContentFilterReason to NIP-56 report types.
  • Updated useReportContent() to use mapped NIP-56 values in:
    • ["e", "<eventId>", "<nip56-type>"]
    • ["p", "<pubkey>", "<nip56-type>"]
  • Kept NIP-32 label tags unchanged so app-level semantics remain queryable:
    • ["L", "social.nos.ontology"]
    • ["l", "NS-<app-reason>", "social.nos.ontology"]
  • Added unit tests covering:
    • full mapping table
    • published report tags for kind 1984
    • regression checks to ensure raw app-level reasons are not used in e/p

Related

Closes #280

@github-actions
Copy link
Copy Markdown

🚀 Preview Deployment

Property Value
Preview URL https://3087de7d.divine-web-fm8.pages.dev
Commit 9cd12a5
Branch fix/280-align-e/p-tag-report-types-with-NIP-56-standard-values

Copy link
Copy Markdown
Member

@mbradley mbradley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean fix -- mapping is exhaustive, tests cover the full contract, and the NS-* NIP-32 labels are preserved unchanged so relay-manager's report UI won't lose any categorization fidelity.

One minor observation: HARASSMENT to profanity is the best available NIP-56 match, but it's worth noting that this is a lossy mapping by design. The NS-harassment label in the l tag is what carries the actual intent. Relay operators or other clients consuming only the e/p tag will see "profanity" where the user meant "harassment."

Approving -- this is ready to merge.

@DSanich
Copy link
Copy Markdown
Contributor Author

DSanich commented Apr 29, 2026

mbradley
Clean fix -- mapping is exhaustive, tests cover the full contract, and the NS-* NIP-32 labels are preserved unchanged so relay-manager's report UI won't lose any categorization fidelity.

One minor observation: HARASSMENT to profanity is the best available NIP-56 match, but it's worth noting that this is a lossy mapping by design. The NS-harassment label in the l tag is what carries the actual intent. Relay operators or other clients consuming only the e/p tag will see "profanity" where the user meant "harassment."

Approving -- this is ready to merge.

@mbradley TYSM for your review! I will wait new assignments from you, @jalcine and @NotThatKindOfDrLiz

@jalcine
Copy link
Copy Markdown
Contributor

jalcine commented May 20, 2026

These changes are already handled now upstream!

@jalcine jalcine closed this May 20, 2026
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.

fix(reports): align e/p tag report types with NIP-56 standard values

3 participants