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.
This commit is contained in:
@@ -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
|
||||
});
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user