fix: reply count

This commit is contained in:
codytseng
2025-06-02 12:29:48 +08:00
parent d2ceb16a58
commit c777a1564e
3 changed files with 15 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
import client from '@/services/client.service'
import { createContext, useContext, useEffect, useState } from 'react'
import { createContext, useCallback, useContext, useEffect, useState } from 'react'
import { useNostr } from './NostrProvider'
import storage from '@/services/local-storage.service'
@@ -41,16 +41,19 @@ export function UserTrustProvider({ children }: { children: React.ReactNode }) {
initWoT()
}, [currentPubkey])
const isUserTrusted = useCallback(
(pubkey: string) => {
if (!currentPubkey || !enabled) return true
return wotSet.has(pubkey)
},
[enabled]
)
const updateEnabled = (enabled: boolean) => {
setEnabled(enabled)
storage.setHideUntrustedEvents(enabled)
}
const isUserTrusted = (pubkey: string) => {
if (!currentPubkey || !enabled) return true
return wotSet.has(pubkey)
}
return (
<UserTrustContext.Provider value={{ enabled, updateEnabled, isUserTrusted }}>
{children}