diff --git a/src/utils/readsFromBookmarks.ts b/src/utils/readsFromBookmarks.ts index 2fc493c4..ecf43b11 100644 --- a/src/utils/readsFromBookmarks.ts +++ b/src/utils/readsFromBookmarks.ts @@ -2,13 +2,11 @@ import { Bookmark, IndividualBookmark } from '../types/bookmarks' import { ReadItem } from '../services/readsService' import { classifyBookmarkType } from './bookmarkTypeClassifier' import { KINDS } from '../config/kinds' -import { Helpers } from 'applesauce-core' - -const { getArticleTitle, getArticleImage, getArticlePublished, getArticleSummary } = Helpers /** * Derives ReadItems from bookmarks for Nostr articles (kind:30023). - * Returns items with type='article', using hydrated event data when available. + * Returns items with type='article', using hydrated data when available. + * Note: After hydration, article titles are stored in bookmark.content field. */ export function deriveReadsFromBookmarks(bookmarks: Bookmark[]): ReadItem[] { const readsMap = new Map() @@ -22,11 +20,8 @@ export function deriveReadsFromBookmarks(bookmarks: Bookmark[]): ReadItem[] { if (bookmarkType === 'article' && bookmark.kind === KINDS.BlogPost) { const coordinate = bookmark.id // Already in coordinate format - // Extract metadata from event if available - const title = bookmark.event ? getArticleTitle(bookmark.event) : bookmark.title - const summary = bookmark.event ? getArticleSummary(bookmark.event) : bookmark.summary - const image = bookmark.event ? getArticleImage(bookmark.event) : bookmark.image - const published = bookmark.event ? getArticlePublished(bookmark.event) : undefined + // After hydration, article title is in bookmark.content + const title = bookmark.content || 'Untitled' const item: ReadItem = { id: coordinate, @@ -34,13 +29,8 @@ export function deriveReadsFromBookmarks(bookmarks: Bookmark[]): ReadItem[] { type: 'article', readingProgress: 0, readingTimestamp: bookmark.added_at || bookmark.created_at, - event: bookmark.event, - title: title || 'Untitled', - summary, - image, - published, - author: bookmark.pubkey, - url: bookmark.url + title, + author: bookmark.pubkey } readsMap.set(coordinate, item)