feat: publish likes to seen on relays
This commit is contained in:
parent
4bfc9a1fff
commit
47e7a18f2e
2 changed files with 6 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ import { createReactionDraftEvent } from '@/lib/draft-event'
|
|||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import { useScreenSize } from '@/providers/ScreenSizeProvider'
|
||||
import { useUserTrust } from '@/providers/UserTrustProvider'
|
||||
import client from '@/services/client.service'
|
||||
import noteStatsService from '@/services/note-stats.service'
|
||||
import { TEmoji } from '@/types'
|
||||
import { Loader, SmilePlus } from 'lucide-react'
|
||||
|
|
@ -51,7 +52,8 @@ export default function LikeButton({ event }: { event: Event }) {
|
|||
}
|
||||
|
||||
const reaction = createReactionDraftEvent(event, emoji)
|
||||
const evt = await publish(reaction)
|
||||
const seenOn = client.getSeenEventRelayUrls(event.id)
|
||||
const evt = await publish(reaction, { additionalRelayUrls: seenOn })
|
||||
noteStatsService.updateNoteStatsByEvents([evt])
|
||||
} catch (error) {
|
||||
console.error('like failed', error)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { useNoteStatsById } from '@/hooks/useNoteStatsById'
|
|||
import { createReactionDraftEvent } from '@/lib/draft-event'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import client from '@/services/client.service'
|
||||
import noteStatsService from '@/services/note-stats.service'
|
||||
import { TEmoji } from '@/types'
|
||||
import { Loader } from 'lucide-react'
|
||||
|
|
@ -44,7 +45,8 @@ export default function Likes({ event }: { event: Event }) {
|
|||
|
||||
try {
|
||||
const reaction = createReactionDraftEvent(event, emoji)
|
||||
const evt = await publish(reaction)
|
||||
const seenOn = client.getSeenEventRelayUrls(event.id)
|
||||
const evt = await publish(reaction, { additionalRelayUrls: seenOn })
|
||||
noteStatsService.updateNoteStatsByEvents([evt])
|
||||
} catch (error) {
|
||||
console.error('like failed', error)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue