mirror of
https://github.com/fiatjaf/nak.git
synced 2026-10-05 15:18:23 +00:00
publish: reference the parent comment with an e tag when commenting under an external-content (I) thread, instead of pointing at the root i again.
This commit is contained in:
+14
-22
@@ -280,30 +280,22 @@ func buildNIP22Tags(evt *nostr.Event, target *nostr.Event, relayHints []string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// parent tags (lowercase) - always reference the target event
|
// parent tags (lowercase) - always reference the target event
|
||||||
if rootScopeName == "I" {
|
if target.Kind.IsAddressable() || target.Kind.IsReplaceable() {
|
||||||
iTag := nostr.Tag{"i", rootScopeValue}
|
aValue := fmt.Sprintf("%d:%s:%s", target.Kind, target.PubKey.Hex(), dtag())
|
||||||
if rootScopeRelay != "" {
|
aTag := nostr.Tag{"a", aValue}
|
||||||
iTag = append(iTag, rootScopeRelay)
|
if relayHint != "" {
|
||||||
|
aTag = append(aTag, relayHint)
|
||||||
}
|
}
|
||||||
evt.Tags = append(evt.Tags, iTag)
|
evt.Tags = append(evt.Tags, aTag)
|
||||||
} else {
|
|
||||||
if target.Kind.IsAddressable() || target.Kind.IsReplaceable() {
|
|
||||||
aValue := fmt.Sprintf("%d:%s:%s", target.Kind, target.PubKey.Hex(), dtag())
|
|
||||||
aTag := nostr.Tag{"a", aValue}
|
|
||||||
if relayHint != "" {
|
|
||||||
aTag = append(aTag, relayHint)
|
|
||||||
}
|
|
||||||
evt.Tags = append(evt.Tags, aTag)
|
|
||||||
}
|
|
||||||
eTag := nostr.Tag{"e", target.ID.Hex()}
|
|
||||||
if target.PubKey != (nostr.PubKey{}) {
|
|
||||||
// same here: keep the pubkey in the 4th position
|
|
||||||
eTag = append(eTag, relayHint, target.PubKey.Hex())
|
|
||||||
} else if relayHint != "" {
|
|
||||||
eTag = append(eTag, relayHint)
|
|
||||||
}
|
|
||||||
evt.Tags = append(evt.Tags, eTag)
|
|
||||||
}
|
}
|
||||||
|
eTag := nostr.Tag{"e", target.ID.Hex()}
|
||||||
|
if target.PubKey != (nostr.PubKey{}) {
|
||||||
|
// same here: keep the pubkey in the 4th position
|
||||||
|
eTag = append(eTag, relayHint, target.PubKey.Hex())
|
||||||
|
} else if relayHint != "" {
|
||||||
|
eTag = append(eTag, relayHint)
|
||||||
|
}
|
||||||
|
evt.Tags = append(evt.Tags, eTag)
|
||||||
|
|
||||||
evt.Tags = append(evt.Tags, nostr.Tag{"k", fmt.Sprint(target.Kind)})
|
evt.Tags = append(evt.Tags, nostr.Tag{"k", fmt.Sprint(target.Kind)})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user