Simplify comment tags

This commit is contained in:
Jon Staab
2025-03-03 12:53:52 -08:00
parent 100f80d4b8
commit 3e289e9eac
2 changed files with 22 additions and 29 deletions
+4 -13
View File
@@ -97,22 +97,13 @@ export const tagEventForComment = (event: TrustedEvent) => {
const pubkeyHint = ctx.app.router.FromPubkey(event.pubkey).getUrl()
const eventHint = ctx.app.router.Event(event).getUrl()
const address = getAddress(event)
const tags = tagEventPubkeys(event)
const seenRoots = new Set<string>()
const tags: string[][] = []
for (const [raw, ...tag] of event.tags) {
const T = raw.toUpperCase()
const t = raw.toLowerCase()
if (!["k", "e", "a", "i", "p"].includes(t)) {
continue
}
if (seenRoots.has(T)) {
for (const [t, ...tag] of event.tags) {
if (["K", "E", "A", "I", "P"].includes(t)) {
tags.push([t, ...tag])
} else {
tags.push([T, ...tag])
seenRoots.add(T)
seenRoots.add(t)
}
}