Skip to content

Conversation

@tyiu
Copy link
Contributor

@tyiu tyiu commented Mar 28, 2025

NIP-10 - Text Notes and Threads

Those marked with "reply" denote the id of the reply event being responded to. Those marked with "root" denote the root id of the reply thread being responded to. For top level replies (those replying directly to the root event), only the "root" marker should be used.

A direct reply to the root of a thread should have a single marked "e" tag of type "root".

Closes: nostrability/nostrability#174

This bug was causing replies to hellthreads to leak through thread muting preferences on most clients, even if the root was muted.

Example event from @alltheseas that demonstrates the bug when posting from Iris (notice that there is a reply marker where there should actually be both a root and reply marker):
https://iris.to/nevent1qgsxtefrkzdwcyn03g26k3u5vvht5xmm0g5kyp2kajwyu27rk8qdgugpz4mhxue69uhhxarjvee8jtnfwf5hxtn5duhsz9thwden5te0wd68yenj0yhxjunfwvh8gme0qqsdvy3tpv8urd7xz8d9sg5hx28ju8dh93tg0mcpjsledgnps7dltmgt7j94t

Here's some notes that I posted from running this bug fix locally in development that demonstrates the fix working:

Direct reply (has only a root marker): https://iris.to/nevent1qgswjsh886kl767cxkt8h9xfm4cm3xez9zqu6dv6gs6erj8dvymqtzspz4mhxue69uhhxarjvee8jtnfwf5hxtn5duhsz9thwden5te0wfjkccte9ejxzmt4wvhxjme0qqsxr8957h3w28tmdyd9n9h8fvndmwk78mjzwd5r2xz7gdklggy9dmgf32qxr

Reply of a reply (has root and reply markers): https://iris.to/nevent1qgswjsh886kl767cxkt8h9xfm4cm3xez9zqu6dv6gs6erj8dvymqtzspz4mhxue69uhhxarjvee8jtnfwf5hxtn5duhsz9thwden5te0wd68yenj0yhxjunfwvh8gme0qqsfxsj43e58fdfypvalzlj08tdy9t5hzw6n3hkhqgr05lmwkzdm7kqwl9c8v

Hellthread reply (has root and reply markers, and carries over all the p-tags): https://iris.to/nevent1qgswjsh886kl767cxkt8h9xfm4cm3xez9zqu6dv6gs6erj8dvymqtzspz4mhxue69uhhxarjvee8jtnfwf5hxtn5duhsz9thwden5te0wfjkccte9ejxzmt4wvhxjme0qqsd2w3rjmp7w54uwr5ze68ejlh2h9xq35ll83pjzq40x9pmvskhlkq5sczle

Behavior for mentions did not change, proof: https://iris.to/nevent1qgswjsh886kl767cxkt8h9xfm4cm3xez9zqu6dv6gs6erj8dvymqtzspz4mhxue69uhhxarjvee8jtnfwf5hxtn5duhsz9thwden5te0wd68yenj0yhxjunfwvh8gme0qqsf9qfttttuhmf6p5ac5mtrshpfaclrhygum9wrzdfu9rxra66rqccpvswqc

Comment on lines -210 to -218
if (repliedEvent) {
event.tags = [
["p", repliedEvent.pubkey],
["e", repliedEvent.id, "", "reply", repliedEvent.pubkey],
]
}
if (quotedEvent) {
event.tags.push(["e", quotedEvent.id, "", "mention", quotedEvent.pubkey])
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Redundant because the add tags function was already doing all of this. Not sure why it's needed again.

}

function addPTags(event: NDKEvent, repliedEvent?: NDKEvent, quotedEvent?: NDKEvent) {
function addTags(event: NDKEvent, repliedEvent?: NDKEvent, quotedEvent?: NDKEvent) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed addPTags to addTags because it was doing more than just adding p-tags.

@mmalmi mmalmi merged commit 44bb557 into irislib:main Mar 28, 2025
@tyiu tyiu deleted the nip10-bug branch March 28, 2025 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

broken client is omitting the root tag which breaks thread muting

2 participants