Use router Quote for quote relays
This commit is contained in:
@@ -109,7 +109,7 @@
|
|||||||
<ContentMention value={parsed.value} />
|
<ContentMention value={parsed.value} />
|
||||||
{:else if isEvent(parsed) || isAddress(parsed)}
|
{:else if isEvent(parsed) || isAddress(parsed)}
|
||||||
{#if isStartOrEnd(i) && depth < 2 && !hideMedia}
|
{#if isStartOrEnd(i) && depth < 2 && !hideMedia}
|
||||||
<ContentQuote value={parsed.value} {depth}>
|
<ContentQuote value={parsed.value} {depth} {event}>
|
||||||
<div slot="note-content" let:event>
|
<div slot="note-content" let:event>
|
||||||
<svelte:self {hideMedia} {event} depth={depth + 1} />
|
<svelte:self {hideMedia} {event} depth={depth + 1} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {nip19} from "nostr-tools"
|
import {nip19} from "nostr-tools"
|
||||||
import {nthEq} from "@welshman/lib"
|
import {ctx, nthEq} from "@welshman/lib"
|
||||||
import {Address} from "@welshman/util"
|
import {Address} from "@welshman/util"
|
||||||
import type {TrustedEvent} from "@welshman/util"
|
import type {TrustedEvent} from "@welshman/util"
|
||||||
import Link from "@lib/components/Link.svelte"
|
import Link from "@lib/components/Link.svelte"
|
||||||
@@ -10,12 +10,14 @@
|
|||||||
import {makeThreadPath} from "@app/routes"
|
import {makeThreadPath} from "@app/routes"
|
||||||
|
|
||||||
export let value
|
export let value
|
||||||
|
export let event
|
||||||
export let depth = 0
|
export let depth = 0
|
||||||
|
|
||||||
const {id, identifier, kind, pubkey, relays} = value
|
const {id, identifier, kind, pubkey, relays: relayHints = []} = value
|
||||||
const addr = new Address(kind, pubkey, identifier)
|
const addr = new Address(kind, pubkey, identifier)
|
||||||
const idOrAddress = id || addr.toString()
|
const idOrAddress = id || addr.toString()
|
||||||
const event = deriveEvent(idOrAddress, relays)
|
const relays = ctx.app.router.Quote(event, idOrAddress, relayHints).getUrls()
|
||||||
|
const quote = deriveEvent(idOrAddress, relays)
|
||||||
const entity = id ? nip19.neventEncode({id, relays}) : addr.toNaddr()
|
const entity = id ? nip19.neventEncode({id, relays}) : addr.toNaddr()
|
||||||
|
|
||||||
const getLocalHref = (e: TrustedEvent) => {
|
const getLocalHref = (e: TrustedEvent) => {
|
||||||
@@ -32,14 +34,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we found this event on a relay that the user is a member of, redirect internally
|
// If we found this event on a relay that the user is a member of, redirect internally
|
||||||
$: localHref = $event ? getLocalHref($event) : null
|
$: localHref = $quote ? getLocalHref($quote) : null
|
||||||
$: href = localHref || entityLink(entity)
|
$: href = localHref || entityLink(entity)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Link external={!localHref} {href} class="my-2 block max-w-full text-left">
|
<Link external={!localHref} {href} class="my-2 block max-w-full text-left">
|
||||||
{#if $event}
|
{#if $quote}
|
||||||
<NoteCard event={$event} class="bg-alt rounded-box p-4">
|
<NoteCard event={$quote} class="bg-alt rounded-box p-4">
|
||||||
<slot name="note-content" event={$event} {depth} />
|
<slot name="note-content" event={$quote} {depth} />
|
||||||
</NoteCard>
|
</NoteCard>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="rounded-box p-4">
|
<div class="rounded-box p-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user