From f07ebab004fa36e28f4f3eb19bda834c14558b41 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 27 Feb 2026 21:25:29 -0600 Subject: [PATCH] Include kind 1111 comments in feeds and profile 'Posts & replies' tab Add kind 1111 to EXTRA_KINDS tied to feedIncludePosts so comments appear in all feeds (follows, global, communities) and profile feeds. Explicitly exclude kind 1111 from profile 'Posts' tab since they are always replies. Treat kind 1111 like kind 1 in streaming filter so reply/search/media filtering applies consistently. --- src/hooks/useProfileFeed.ts | 1 + src/hooks/useStreamPosts.ts | 5 +++-- src/lib/extraKinds.ts | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/hooks/useProfileFeed.ts b/src/hooks/useProfileFeed.ts index 32ad8e8d..e43ea03b 100644 --- a/src/hooks/useProfileFeed.ts +++ b/src/hooks/useProfileFeed.ts @@ -35,6 +35,7 @@ export function filterByTab(items: FeedItem[], tab: ProfileTab): FeedItem[] { return items.filter((item) => { const e = item.event; if (item.repostedBy) return true; // Always show reposts + if (e.kind === 1111) return false; // Kind 1111 comments are always replies if (e.kind === 1) return !e.tags.some(([n]) => n === 'e'); // Kind 1 without e tags return !e.tags.some(([n]) => n === 'e'); // Other kinds without e tags }); diff --git a/src/hooks/useStreamPosts.ts b/src/hooks/useStreamPosts.ts index 3068ab0d..04a4c0b0 100644 --- a/src/hooks/useStreamPosts.ts +++ b/src/hooks/useStreamPosts.ts @@ -37,8 +37,9 @@ function filterEvent(event: NostrEvent, options: StreamPostsOptions, searchQuery const now = Math.floor(Date.now() / 1000); if (event.created_at > now) return false; - // Non-kind-1 events (extra kinds) pass through without filtering - if (event.kind !== 1) return true; + // Non-text events (extra kinds) pass through without filtering + // Kind 1111 (NIP-22 comments) are treated like kind 1 for filtering purposes + if (event.kind !== 1 && event.kind !== 1111) return true; // Filter replies if (!options.includeReplies) { diff --git a/src/lib/extraKinds.ts b/src/lib/extraKinds.ts index 3c54a11a..d5e207e8 100644 --- a/src/lib/extraKinds.ts +++ b/src/lib/extraKinds.ts @@ -79,6 +79,16 @@ export const EXTRA_KINDS: ExtraKindDef[] = [ section: 'feed', feedOnly: true, }, + { + kind: 1111, + id: 'comments', + feedKey: 'feedIncludePosts', + label: 'Comments', + description: 'NIP-22 comments on posts and external content', + addressable: false, + section: 'feed', + feedOnly: true, + }, { kind: 6, id: 'reposts',