mirror of
https://github.com/dergigi/boris.git
synced 2026-02-19 14:04:38 +01:00
fix(bookmarks): use per-item added_at/created_at when available
- Read / from applesauce pointers for notes/articles - Fallback to eventStore event during enrichment - Keeps sorting by then consistent
This commit is contained in:
@@ -291,10 +291,8 @@ class BookmarkController {
|
||||
const enriched = allBookmarks.map(b => ({
|
||||
...b,
|
||||
tags: b.tags || [],
|
||||
// Prefer hydrated content; fallback to any cached event content in external store
|
||||
content: b.content && b.content.length > 0
|
||||
? b.content
|
||||
: (this.externalEventStore?.getEvent(b.id)?.content || '')
|
||||
content: b.content || this.externalEventStore?.getEvent(b.id)?.content || '', // Fallback to eventStore content
|
||||
created_at: b.created_at || this.externalEventStore?.getEvent(b.id)?.created_at || b.created_at
|
||||
}))
|
||||
|
||||
const sortedBookmarks = enriched
|
||||
|
||||
@@ -21,12 +21,16 @@ export interface AddressPointer {
|
||||
pubkey: string
|
||||
identifier: string
|
||||
relays?: string[]
|
||||
added_at?: number
|
||||
created_at?: number
|
||||
}
|
||||
|
||||
export interface EventPointer {
|
||||
id: string
|
||||
relays?: string[]
|
||||
author?: string
|
||||
added_at?: number
|
||||
created_at?: number
|
||||
}
|
||||
|
||||
export interface ApplesauceBookmarks {
|
||||
@@ -77,14 +81,14 @@ export const processApplesauceBookmarks = (
|
||||
allItems.push({
|
||||
id: note.id,
|
||||
content: '',
|
||||
created_at: parentCreatedAt || 0,
|
||||
created_at: note.created_at || parentCreatedAt || 0,
|
||||
pubkey: note.author || activeAccount.pubkey,
|
||||
kind: 1, // Short note kind
|
||||
tags: [],
|
||||
parsedContent: undefined,
|
||||
type: 'event' as const,
|
||||
isPrivate,
|
||||
added_at: parentCreatedAt || 0
|
||||
added_at: note.added_at || parentCreatedAt || 0
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -97,14 +101,14 @@ export const processApplesauceBookmarks = (
|
||||
allItems.push({
|
||||
id: coordinate,
|
||||
content: '',
|
||||
created_at: parentCreatedAt || 0,
|
||||
created_at: article.created_at || parentCreatedAt || 0,
|
||||
pubkey: article.pubkey,
|
||||
kind: article.kind, // Usually 30023 for long-form articles
|
||||
tags: [],
|
||||
parsedContent: undefined,
|
||||
type: 'event' as const,
|
||||
isPrivate,
|
||||
added_at: parentCreatedAt || 0
|
||||
added_at: article.added_at || parentCreatedAt || 0
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user