Use getAncestorTags in router

This commit is contained in:
Jon Staab
2025-06-16 08:40:35 -07:00
parent 09f6db7eae
commit 49fecd2291
2 changed files with 6 additions and 6 deletions
+2 -5
View File
@@ -18,19 +18,17 @@ import {
isOnionUrl, isOnionUrl,
isLocalUrl, isLocalUrl,
isShareableRelayUrl, isShareableRelayUrl,
COMMENT,
PROFILE, PROFILE,
RELAYS, RELAYS,
INBOX_RELAYS, INBOX_RELAYS,
FOLLOWS, FOLLOWS,
WRAP, WRAP,
getReplyTags,
getCommentTags,
getPubkeyTagValues, getPubkeyTagValues,
normalizeRelayUrl, normalizeRelayUrl,
TrustedEvent, TrustedEvent,
Filter, Filter,
readList, readList,
getAncestorTags,
asDecryptedEvent, asDecryptedEvent,
getRelaysFromList, getRelaysFromList,
RelayMode, RelayMode,
@@ -215,8 +213,7 @@ export class Router {
} }
EventAncestors = (event: TrustedEvent, type: "mentions" | "replies" | "roots") => { EventAncestors = (event: TrustedEvent, type: "mentions" | "replies" | "roots") => {
const ancestorTags = const ancestorTags = getAncestorTags(event)
event.kind === COMMENT ? getCommentTags(event.tags) : getReplyTags(event.tags)
const tags: string[][] = (ancestorTags as any)[type] || [] const tags: string[][] = (ancestorTags as any)[type] || []
+4 -1
View File
@@ -2,7 +2,7 @@ import {verifiedSymbol, verifyEvent as verifyEventPure} from "nostr-tools/pure"
import {setNostrWasm, verifyEvent as verifyEventWasm} from "nostr-tools/wasm" import {setNostrWasm, verifyEvent as verifyEventWasm} from "nostr-tools/wasm"
import {initNostrWasm} from "nostr-wasm" import {initNostrWasm} from "nostr-wasm"
import {mapVals, first, pick, now} from "@welshman/lib" import {mapVals, first, pick, now} from "@welshman/lib"
import {getReplyTagValues, getCommentTagValues} from "./Tags.js" import {getReplyTags, getCommentTags, getReplyTagValues, getCommentTagValues} from "./Tags.js"
import {getAddress, Address} from "./Address.js" import {getAddress, Address} from "./Address.js"
import { import {
COMMENT, COMMENT,
@@ -145,6 +145,9 @@ export const isPlainReplaceable = (e: EventTemplate) => isPlainReplaceableKind(e
export const isParameterizedReplaceable = (e: EventTemplate) => export const isParameterizedReplaceable = (e: EventTemplate) =>
isParameterizedReplaceableKind(e.kind) isParameterizedReplaceableKind(e.kind)
export const getAncestorTags = ({kind, tags}: EventTemplate) =>
kind === COMMENT ? getCommentTags(tags) : getReplyTags(tags)
export const getAncestors = ({kind, tags}: EventTemplate) => export const getAncestors = ({kind, tags}: EventTemplate) =>
kind === COMMENT ? getCommentTagValues(tags) : getReplyTagValues(tags) kind === COMMENT ? getCommentTagValues(tags) : getReplyTagValues(tags)