Skip to content

Conversation

@tyiu
Copy link
Collaborator

@tyiu tyiu commented Jul 13, 2025

Summary

This PR adds relay hints to tags and identifiers to improve content discovery on the network. Previously, we were referencing identifiers without them, so other clients would need to guess where to look for that content, leading to a broken user experience.

This PR does not take care of all the places that could have relay hints added. It only adds the ones where it's convenient. To fully tackle the rest, we would need a fundamental change in some of the core code.

Checklist

  • I have read (or I am familiar with) the Contribution Guidelines
  • I have tested the changes in this PR
  • I have opened or referred to an existing github issue related to this change.
  • My PR is either small, or I have split it into smaller logical commits that are easier to review
  • I have added the signoff line to all my commits. See Signing off your work
  • I have added appropriate changelog entries for the changes in this PR. See Adding changelog entries
  • I have added appropriate Closes: or Fixes: tags in the commit messages wherever applicable, or made sure those are not needed. See Submitting patches

Test report

Device: iPhone 16 Pro Simulator

iOS: 18.5

Damus: 96cd6dc

Steps:

  1. Go to any note and tap on the ... menu, and tap Copy note ID.
  2. Observe that the clipboard has an nevent instead of a note1 identifier now.
  3. Paste that nevent identifier into search and observe that note appear.
  4. Also paste it into https://njump.me/nevent... and observe that it appears there as well.
  5. Tap the share button on any note and Copy Link.
  6. Observe that the clipboard has an nevent. This has not changed, but the selection of relays now prefers actual relays that we found the event from first.
  7. Repeat step 5-6 but use Share Link instead.
  8. Try replying to threads, reposting, quote reposting, reacting. You should observe that we now provide relay hints in the e and p tags.
  9. For quote reposting, observe that there is a nostr:nevent... appended to the end of the note content instead of a nostr:note1...

Results:

  • PASS

Comment on lines -912 to -913
if let quoted_ev = state.events.lookup(ev.id) {
tags.append(["p", quoted_ev.pubkey.hex()])
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I actually don't understand this code. Why do a lookup again when we already have the quoted event pubkey? Seems like a bug?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure, looks like an oversight or the result of a refactor. removing it looks fine to me

@tyiu tyiu marked this pull request as draft July 15, 2025 16:48
@tyiu tyiu marked this pull request as ready for review July 15, 2025 17:02
Changelog-Added: Add relay hints to tags and identifiers
Signed-off-by: Terry Yiu <git@tyiu.xyz>
Copy link
Collaborator

@jb55 jb55 left a comment

Choose a reason for hiding this comment

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

nice!

Comment on lines -912 to -913
if let quoted_ev = state.events.lookup(ev.id) {
tags.append(["p", quoted_ev.pubkey.hex()])
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure, looks like an oversight or the result of a refactor. removing it looks fine to me

Copy link
Collaborator

@danieldaquino danieldaquino left a comment

Choose a reason for hiding this comment

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

Thank you @tyiu, looks good!

@danieldaquino danieldaquino merged commit 793970b into damus-io:master Jul 18, 2025
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.

4 participants