Browse Source

include web bookmarks in feeds

imwald
Silberengel 1 week ago
parent
commit
101b76b97f
  1. 1
      src/constants.ts
  2. 3
      src/lib/feed-kind-filter.test.ts
  3. 5
      src/lib/feed-kind-filter.ts

1
src/constants.ts

@ -1001,6 +1001,7 @@ export const SUPPORTED_KINDS = [
kinds.LongFormArticle, kinds.LongFormArticle,
ExtendedKind.RELAY_REVIEW, ExtendedKind.RELAY_REVIEW,
ExtendedKind.DISCUSSION, ExtendedKind.DISCUSSION,
ExtendedKind.WEB_BOOKMARK,
ExtendedKind.ZAP_RECEIPT, ExtendedKind.ZAP_RECEIPT,
ExtendedKind.CALENDAR_EVENT_DATE, ExtendedKind.CALENDAR_EVENT_DATE,
ExtendedKind.CALENDAR_EVENT_TIME, ExtendedKind.CALENDAR_EVENT_TIME,

3
src/lib/feed-kind-filter.test.ts

@ -25,7 +25,7 @@ function fakeEvent(partial: Partial<Event> & Pick<Event, 'kind' | 'tags'>): Even
} }
describe('feed kind groups', () => { describe('feed kind groups', () => {
it('posts group toggles kind 1 OPs, highlights, discussions, photos, and voice posts together', () => { it('posts group toggles kind 1 OPs, highlights, discussions, photos, voice posts, and web bookmarks together', () => {
const off = applyFeedPostsGroupToggle([], false) const off = applyFeedPostsGroupToggle([], false)
expect(off.showKind1OPs).toBe(false) expect(off.showKind1OPs).toBe(false)
expect(isFeedPostsGroupEnabled(off.showKind1OPs, off.showKinds)).toBe(false) expect(isFeedPostsGroupEnabled(off.showKind1OPs, off.showKinds)).toBe(false)
@ -37,6 +37,7 @@ describe('feed kind groups', () => {
expect(on.showKinds).toContain(ExtendedKind.PICTURE) expect(on.showKinds).toContain(ExtendedKind.PICTURE)
expect(on.showKinds).toContain(ExtendedKind.VOICE) expect(on.showKinds).toContain(ExtendedKind.VOICE)
expect(on.showKinds).toContain(ExtendedKind.MUSIC_TRACK) expect(on.showKinds).toContain(ExtendedKind.MUSIC_TRACK)
expect(on.showKinds).toContain(ExtendedKind.WEB_BOOKMARK)
expect(isFeedPostsGroupEnabled(on.showKind1OPs, on.showKinds)).toBe(true) expect(isFeedPostsGroupEnabled(on.showKind1OPs, on.showKinds)).toBe(true)
}) })

5
src/lib/feed-kind-filter.ts

@ -3,13 +3,14 @@ import { isReplyNoteEvent } from '@/lib/event'
import type { Event } from 'nostr-tools' import type { Event } from 'nostr-tools'
import { kinds } from 'nostr-tools' import { kinds } from 'nostr-tools'
/** Kind 1 OPs, highlights, discussions, photos, voice posts — feed filter “Posts” group. */ /** Kind 1 OPs, highlights, discussions, photos, voice posts, web bookmarks — feed filter “Posts” group. */
export const FEED_POSTS_GROUP_KINDS: readonly number[] = [ export const FEED_POSTS_GROUP_KINDS: readonly number[] = [
kinds.Highlights, kinds.Highlights,
ExtendedKind.DISCUSSION, ExtendedKind.DISCUSSION,
ExtendedKind.PICTURE, ExtendedKind.PICTURE,
ExtendedKind.VOICE, ExtendedKind.VOICE,
ExtendedKind.MUSIC_TRACK ExtendedKind.MUSIC_TRACK,
ExtendedKind.WEB_BOOKMARK
] ]
/** Kind 1 replies, comments, voice comments, superchats — feed filter “Replies” group. */ /** Kind 1 replies, comments, voice comments, superchats — feed filter “Replies” group. */

Loading…
Cancel
Save