Skip to content

Commit

Permalink
nostr: include public key of root and parent author in `EventBuilder:…
Browse files Browse the repository at this point in the history
…:comment`

#653 (comment)
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
  • Loading branch information
yukibtc committed Dec 30, 2024
1 parent e11d0af commit 88d949d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/nostr/src/event/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,9 @@ impl EventBuilder {
}
}

// Add `p` tag of `root` event
tags.push(Tag::public_key(root.pubkey));

// Kind
tags.push(Tag::from_standardized_without_cell(TagStandard::Kind {
kind: root.kind,
Expand All @@ -537,6 +540,9 @@ impl EventBuilder {
);
}

// Add `p` tag of `comment_to` event
tags.push(Tag::public_key(comment_to.pubkey));

// Add `a` tag (if event has it)
if let Some(coordinate) = comment_to.coordinate() {
tags.push(Tag::from_standardized_without_cell(
Expand Down

3 comments on commit 88d949d

@dluvian
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yukibtc I think it would be better if the parent's author p-tag was the first p-tag, as it is the most important.

@dluvian
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the parent's tags are more important than the root's tags. So the parent's p-tags should be added first

@yukibtc
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the fix to dedup the tags, all the tags are sorted in ASC order 😅
But that is a temp fix, I'll look for another solution for the next releases. Tomorrow I'll release the v0.38.

Please sign in to comment.