feat: add pinned post functionality
This commit is contained in:
@@ -838,14 +838,13 @@ class ClientService extends EventTarget {
|
||||
}
|
||||
|
||||
let event: NEvent | undefined
|
||||
if (filter.ids) {
|
||||
if (filter.ids?.length) {
|
||||
event = await this.fetchEventById(relays, filter.ids[0])
|
||||
} else {
|
||||
if (author) {
|
||||
const relayList = await this.fetchRelayList(author)
|
||||
relays.push(...relayList.write.slice(0, 4))
|
||||
}
|
||||
event = await this.tryHarderToFetchEvent(relays, filter)
|
||||
}
|
||||
|
||||
if (!event && author) {
|
||||
const relayList = await this.fetchRelayList(author)
|
||||
event = await this.tryHarderToFetchEvent(relayList.write.slice(0, 5), filter)
|
||||
}
|
||||
|
||||
if (event && event.id !== id) {
|
||||
@@ -1261,6 +1260,8 @@ class ClientService extends EventTarget {
|
||||
return params.map(({ pubkey, kind, d }) => {
|
||||
const key = `${kind}:${pubkey}:${d ?? ''}`
|
||||
const event = eventMap.get(key)
|
||||
if (kind === kinds.Pinlist) return event ?? null
|
||||
|
||||
if (event) {
|
||||
indexedDb.putReplaceableEvent(event)
|
||||
return event
|
||||
@@ -1321,6 +1322,10 @@ class ClientService extends EventTarget {
|
||||
return evt ? getServersFromServerTags(evt.tags) : []
|
||||
}
|
||||
|
||||
async fetchPinListEvent(pubkey: string) {
|
||||
return this.fetchReplaceableEvent(pubkey, kinds.Pinlist)
|
||||
}
|
||||
|
||||
async updateBlossomServerListEventCache(evt: NEvent) {
|
||||
await this.updateReplaceableEventCache(evt)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user