fix: ensure events are sent to mentioned users' read relays
This commit is contained in:
parent
24a18e4d7a
commit
78caabeafc
7 changed files with 45 additions and 55 deletions
|
|
@ -2,7 +2,6 @@ import { createReactionDraftEvent } from '@/lib/draft-event'
|
|||
import { cn } from '@/lib/utils'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import { useNoteStats } from '@/providers/NoteStatsProvider'
|
||||
import client from '@/services/client.service'
|
||||
import { Heart, Loader } from 'lucide-react'
|
||||
import { Event } from 'nostr-tools'
|
||||
import { useMemo, useState } from 'react'
|
||||
|
|
@ -37,11 +36,8 @@ export default function LikeButton({ event }: { event: Event }) {
|
|||
if (stats?.likes?.has(pubkey)) return
|
||||
}
|
||||
|
||||
const targetRelayList = await client.fetchRelayList(event.pubkey)
|
||||
const reaction = createReactionDraftEvent(event)
|
||||
const evt = await publish(reaction, {
|
||||
additionalRelayUrls: targetRelayList.read.slice(0, 4)
|
||||
})
|
||||
const evt = await publish(reaction)
|
||||
updateNoteStatsByEvents([evt])
|
||||
} catch (error) {
|
||||
console.error('like failed', error)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import { cn } from '@/lib/utils'
|
|||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import { useNoteStats } from '@/providers/NoteStatsProvider'
|
||||
import { useScreenSize } from '@/providers/ScreenSizeProvider'
|
||||
import client from '@/services/client.service'
|
||||
import { Loader, PencilLine, Repeat } from 'lucide-react'
|
||||
import { Event } from 'nostr-tools'
|
||||
import { useMemo, useState } from 'react'
|
||||
|
|
@ -53,9 +52,8 @@ export default function RepostButton({ event }: { event: Event }) {
|
|||
if (stats?.reposts?.has(pubkey)) return
|
||||
}
|
||||
|
||||
const targetRelayList = await client.fetchRelayList(event.pubkey)
|
||||
const repost = createRepostDraftEvent(event)
|
||||
const evt = await publish(repost, { additionalRelayUrls: targetRelayList.read.slice(0, 5) })
|
||||
const evt = await publish(repost)
|
||||
updateNoteStatsByEvents([evt])
|
||||
} catch (error) {
|
||||
console.error('repost failed', error)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue