refactor: post editor
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { BIG_RELAY_URLS, ExtendedKind } from '@/constants'
|
||||
import { getProfileFromProfileEvent, getRelayListFromRelayListEvent } from '@/lib/event'
|
||||
import { formatPubkey, userIdToPubkey } from '@/lib/pubkey'
|
||||
import { formatPubkey, pubkeyToNpub, userIdToPubkey } from '@/lib/pubkey'
|
||||
import { extractPubkeysFromEventTags } from '@/lib/tag'
|
||||
import { isLocalNetworkUrl, isWebsocketUrl, normalizeUrl } from '@/lib/url'
|
||||
import { ISigner, TProfile, TRelayList } from '@/types'
|
||||
@@ -693,7 +693,7 @@ class ClientService extends EventTarget {
|
||||
|
||||
try {
|
||||
const pubkey = userIdToPubkey(id)
|
||||
return { pubkey, username: formatPubkey(pubkey) }
|
||||
return { pubkey, npub: pubkeyToNpub(pubkey) ?? '', username: formatPubkey(pubkey) }
|
||||
} catch {
|
||||
return undefined
|
||||
}
|
||||
@@ -833,11 +833,9 @@ class ClientService extends EventTarget {
|
||||
this.relayListEventDataLoader.prime(event.pubkey, Promise.resolve(event))
|
||||
}
|
||||
|
||||
async searchProfilesFromIndex(query: string, limit: number = 100) {
|
||||
async searchNpubs(query: string, limit: number = 100) {
|
||||
const result = await this.userIndex.searchAsync(query, { limit })
|
||||
return Promise.all(result.map((pubkey) => this.fetchProfile(pubkey as string))).then(
|
||||
(profiles) => profiles.filter(Boolean) as TProfile[]
|
||||
)
|
||||
return result.map((pubkey) => pubkeyToNpub(pubkey as string)).filter(Boolean) as string[]
|
||||
}
|
||||
|
||||
async initUserIndexFromFollowings(pubkey: string, signal: AbortSignal) {
|
||||
|
||||
Reference in New Issue
Block a user