commit c000a7d27b34b177c8e07c2af31214cb281519f9
parent faaa3c9d5485fba1e2987bfe3191ce6d55dbcc36
Author: kernelkind <kernelkind@gmail.com>
Date: Tue, 24 Feb 2026 18:33:21 -0500
feat(outbox-int): use outbox for broadcasting note
Signed-off-by: kernelkind <kernelkind@gmail.com>
Diffstat:
4 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/crates/notedeck/src/note/context.rs b/crates/notedeck/src/note/context.rs
@@ -1,8 +1,8 @@
-use enostr::{ClientMessage, NoteId, Pubkey, RelayPool};
+use enostr::{NoteId, Pubkey, RelayId, RelayPool};
use nostrdb::{Ndb, Note, NoteKey, Transaction};
use tracing::error;
-use crate::Accounts;
+use crate::{Accounts, RelayType, RemoteApi};
/// When broadcasting notes, this determines whether to broadcast
/// over the local network via multicast, or globally
@@ -48,27 +48,25 @@ fn note_nip19_event_bech(note: &Note<'_>, txn: &Transaction) -> Option<String> {
}
impl NoteContextSelection {
+ #[allow(clippy::too_many_arguments)]
pub fn process_selection(
&self,
ui: &mut egui::Ui,
note: &Note<'_>,
ndb: &Ndb,
pool: &mut RelayPool,
+ remote: &mut RemoteApi,
txn: &Transaction,
accounts: &Accounts,
) {
match self {
NoteContextSelection::Broadcast(context) => {
tracing::info!("Broadcasting note {}", hex::encode(note.id()));
- match context {
- BroadcastContext::LocalNetwork => {
- pool.send_to(&ClientMessage::event(note).unwrap(), "multicast");
- }
-
- BroadcastContext::Everywhere => {
- pool.send(&ClientMessage::event(note).unwrap());
- }
- }
+ let relays = match context {
+ BroadcastContext::LocalNetwork => RelayType::Explicit(vec![RelayId::Multicast]),
+ BroadcastContext::Everywhere => RelayType::AccountsWrite,
+ };
+ remote.publisher(accounts).publish_note(note, relays);
}
NoteContextSelection::CopyText => {
ui.ctx().copy_text(note.content().to_string());
diff --git a/crates/notedeck_chrome/src/chrome.rs b/crates/notedeck_chrome/src/chrome.rs
@@ -575,6 +575,7 @@ fn chrome_handle_app_action(
&mut columns.threads,
ctx.note_cache,
ctx.legacy_pool,
+ &mut ctx.remote,
&txn,
ctx.unknown_ids,
ctx.accounts,
@@ -632,6 +633,7 @@ fn columns_route_to_profile(
&mut columns.threads,
ctx.note_cache,
ctx.legacy_pool,
+ &mut ctx.remote,
&txn,
ctx.unknown_ids,
ctx.accounts,
diff --git a/crates/notedeck_columns/src/actionbar.rs b/crates/notedeck_columns/src/actionbar.rs
@@ -18,7 +18,7 @@ use notedeck::{
get_wallet_for, is_future_timestamp,
note::{reaction_sent_id, ReactAction, ZapTargetAmount},
unix_time_secs, Accounts, GlobalWallet, Images, MediaJobSender, NoteAction, NoteCache,
- NoteZapTargetOwned, UnknownIds, ZapAction, ZapTarget, ZappingError, Zaps,
+ NoteZapTargetOwned, RemoteApi, UnknownIds, ZapAction, ZapTarget, ZappingError, Zaps,
};
use notedeck_ui::media::MediaViewerFlags;
use tracing::error;
@@ -52,6 +52,7 @@ fn execute_note_action(
threads: &mut Threads,
note_cache: &mut NoteCache,
pool: &mut RelayPool,
+ remote: &mut RemoteApi<'_>,
txn: &Transaction,
accounts: &mut Accounts,
global_wallet: &mut GlobalWallet,
@@ -221,7 +222,7 @@ fn execute_note_action(
} else {
context
.action
- .process_selection(ui, ¬e, ndb, pool, txn, accounts);
+ .process_selection(ui, ¬e, ndb, pool, remote, txn, accounts);
}
}
},
@@ -256,6 +257,7 @@ pub fn execute_and_process_note_action(
threads: &mut Threads,
note_cache: &mut NoteCache,
pool: &mut RelayPool,
+ remote: &mut RemoteApi<'_>,
txn: &Transaction,
unknown_ids: &mut UnknownIds,
accounts: &mut Accounts,
@@ -283,6 +285,7 @@ pub fn execute_and_process_note_action(
threads,
note_cache,
pool,
+ remote,
txn,
accounts,
global_wallet,
diff --git a/crates/notedeck_columns/src/nav.rs b/crates/notedeck_columns/src/nav.rs
@@ -572,6 +572,7 @@ fn process_render_nav_action(
&mut app.threads,
ctx.note_cache,
ctx.legacy_pool,
+ &mut ctx.remote,
&txn,
ctx.unknown_ids,
ctx.accounts,