Fix showing parents on notifications

This commit is contained in:
Jon Staab 2023-12-08 08:52:44 -08:00
parent 64ecbf9ac1
commit e51db5f343

View File

@ -91,7 +91,7 @@
const goToParent = () => { const goToParent = () => {
router router
.at("notes") .at("notes")
.of(getParentId(note), {relays: tags.getReplyHints()}) .of(getParentId(event), {relays: tags.getReplyHints()})
.cx({context: ctx.concat(event)}) .cx({context: ctx.concat(event)})
.open() .open()
} }
@ -162,12 +162,12 @@
) )
onMount(async () => { onMount(async () => {
const zapAddress = Tags.from(note).getValue("zap") const zapAddress = Tags.from(event).getValue("zap")
if (zapAddress && getLnUrl(zapAddress)) { if (zapAddress && getLnUrl(zapAddress)) {
zapper = await getZapper(getLnUrl(zapAddress)) zapper = await getZapper(getLnUrl(zapAddress))
} else { } else {
unsubZapper = people.key(note.pubkey).subscribe($p => { unsubZapper = people.key(event.pubkey).subscribe($p => {
zapper = $p?.zapper zapper = $p?.zapper
}) })
} }
@ -214,8 +214,8 @@
</script> </script>
{#if ready} {#if ready}
{@const rootId = getRootId(note)} {@const rootId = getRootId(event)}
{@const replyId = getParentId(note)} {@const replyId = getParentId(event)}
{@const path = router {@const path = router
.at("notes") .at("notes")
.of(event.id, {relays: getEventHints(event)}) .of(event.id, {relays: getEventHints(event)})
@ -248,13 +248,13 @@
</div> </div>
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<div class="flex gap-2"> <div class="flex gap-2">
{#if replyId && !getParentIds(note).includes(anchor) && showParent} {#if replyId && !getParentIds(event).includes(anchor) && showParent}
<small class="text-gray-1"> <small class="text-gray-1">
<i class="fa fa-code-merge" /> <i class="fa fa-code-merge" />
<Anchor class="underline" on:click={goToParent}>View Parent</Anchor> <Anchor class="underline" on:click={goToParent}>View Parent</Anchor>
</small> </small>
{/if} {/if}
{#if rootId && !getRootIds(note).includes(anchor) && rootId !== replyId && showParent} {#if rootId && !getRootIds(event).includes(anchor) && rootId !== replyId && showParent}
<small class="text-gray-1"> <small class="text-gray-1">
<i class="fa fa-code-pull-request" /> <i class="fa fa-code-pull-request" />
<Anchor class="underline" on:click={goToThread}>View Thread</Anchor> <Anchor class="underline" on:click={goToThread}>View Thread</Anchor>