notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit d44939a1f4566dc08ed6d47661cd81cfa5e7450b
parent f39154e3c9068301dc856eebeaea897697023d49
Author: alltheseas <alltheseas@users.noreply.github.com>
Date:   Wed, 29 Oct 2025 10:03:50 -0500

Include relay hints when copying note IDs

Diffstat:
Mcrates/notedeck/src/note/context.rs | 14++++++++++++--
Mcrates/notedeck_columns/src/actionbar.rs | 1+
2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/crates/notedeck/src/note/context.rs b/crates/notedeck/src/note/context.rs @@ -1,5 +1,5 @@ use enostr::{ClientMessage, NoteId, Pubkey, RelayPool}; -use nostrdb::{Note, NoteKey}; +use nostrdb::{Note, NoteKey, Transaction}; use tracing::error; /// When broadcasting notes, this determines whether to broadcast @@ -33,6 +33,7 @@ impl NoteContextSelection { ui: &mut egui::Ui, note: &Note<'_>, pool: &mut RelayPool, + txn: &Transaction, note_author_is_selected_acc: bool, ) { match self { @@ -57,9 +58,18 @@ impl NoteContextSelection { } } NoteContextSelection::CopyNoteId => { + let mut relay_hints: Vec<String> = + note.relays(txn).take(1).map(|relay| relay.to_owned()).collect(); + + if relay_hints.is_empty() { + if let Some(pool_relay) = pool.urls().into_iter().next() { + relay_hints.push(pool_relay); + } + } + let nip19event = nostr::nips::nip19::Nip19Event::new( nostr::event::EventId::from_byte_array(*note.id()), - Vec::<String>::new(), + relay_hints, ); let Ok(bech) = nostr::nips::nip19::ToBech32::to_bech32(&nip19event) else { return; diff --git a/crates/notedeck_columns/src/actionbar.rs b/crates/notedeck_columns/src/actionbar.rs @@ -193,6 +193,7 @@ fn execute_note_action( ui, &note, pool, + txn, accounts.selected_account_pubkey().bytes() == note.pubkey(), ); }