From b266288b0ff63a8e717a8698fb79b5a8b9d78230 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 9 Oct 2025 18:36:20 +0100 Subject: [PATCH] fix: add p tag (author tag) to highlights of nostr-native content - Highlights now include p tag referencing original article author - Allows authors to discover highlights of their work - Follows NIP-84 best practices for highlight attribution --- src/services/highlightCreationService.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/services/highlightCreationService.ts b/src/services/highlightCreationService.ts index 365e3ebd..4b4a554b 100644 --- a/src/services/highlightCreationService.ts +++ b/src/services/highlightCreationService.ts @@ -80,6 +80,16 @@ export async function createHighlight( highlightEvent.tags.push(['alt', 'Highlight created by Boris. readwithboris.com']) } + // Add p tag (author tag) for nostr-native content + // This tags the original author so they can see highlights of their work + if (typeof source === 'object' && 'kind' in source) { + // Only add p tag if it doesn't already exist + const hasPTag = highlightEvent.tags.some(tag => tag[0] === 'p' && tag[1] === source.pubkey) + if (!hasPTag) { + highlightEvent.tags.push(['p', source.pubkey]) + } + } + // Add zap tags for nostr-native content (NIP-57 Appendix G) if (typeof source === 'object' && 'kind' in source) { // Migrate old settings format to new weight-based format if needed