This commit is contained in:
@@ -2,6 +2,7 @@ import {tryCatch, batcher, postJson} from "@welshman/lib"
|
||||
import type {Maybe} from "@welshman/lib"
|
||||
import {queryProfile, displayNip05} from "@welshman/util"
|
||||
import type {Handle} from "@welshman/util"
|
||||
import type {Profile} from "@welshman/domain"
|
||||
import {deriveDeduplicated} from "@welshman/store"
|
||||
import {LoadableMapPlugin, projection} from "./base.js"
|
||||
import type {Projection} from "./base.js"
|
||||
@@ -60,16 +61,20 @@ export class Handles extends LoadableMapPlugin<Handle> {
|
||||
loadForPubkey = async (pubkey: string, relays: string[] = []) => {
|
||||
const $profile = await this.app.use(Profiles).load(pubkey, relays)
|
||||
|
||||
return $profile?.nip05 ? this.load($profile.nip05) : undefined
|
||||
const nip05 = $profile?.nip05()
|
||||
|
||||
return nip05 ? this.load(nip05) : undefined
|
||||
}
|
||||
|
||||
forPubkey = (pubkey: string, relays: string[] = []): Projection<Maybe<Handle>> => {
|
||||
this.loadForPubkey(pubkey, relays)
|
||||
|
||||
const read = ([$handlesByNip05, $profile]: [ReadonlyMap<string, Handle>, Maybe<{nip05?: string}>]) => {
|
||||
if (!$profile?.nip05) return undefined
|
||||
const read = ([$handlesByNip05, $profile]: [ReadonlyMap<string, Handle>, Maybe<Profile>]) => {
|
||||
const nip05 = $profile?.nip05()
|
||||
|
||||
const handle = $handlesByNip05.get($profile.nip05)
|
||||
if (!nip05) return undefined
|
||||
|
||||
const handle = $handlesByNip05.get(nip05)
|
||||
|
||||
if (handle?.pubkey !== pubkey) return undefined
|
||||
|
||||
|
||||
Reference in New Issue
Block a user