commit b58b1ca640ff781a52e616d16414ce54872f166d
parent a8de23b12a103629901a178c0e7d5a0078beeb64
Author: kernelkind <kernelkind@gmail.com>
Date: Wed, 25 Feb 2026 21:41:19 -0500
feat(outbox-int): use outbox for sending mutes, unmutes & reports
Signed-off-by: kernelkind <kernelkind@gmail.com>
Diffstat:
7 files changed, 48 insertions(+), 45 deletions(-)
diff --git a/crates/notedeck/src/lib.rs b/crates/notedeck/src/lib.rs
@@ -84,9 +84,9 @@ pub use nav::DragResponse;
pub use nip05::{Nip05Cache, Nip05Status};
pub use nip51_set::{create_nip51_set, Nip51Set, Nip51SetCache};
pub use note::{
- builder_from_note, get_p_tags, send_mute_event, send_note_builder, send_people_list_event,
- send_report_event, send_unmute_event, BroadcastContext, ContextSelection, NoteAction,
- NoteContext, NoteContextSelection, NoteRef, ReportTarget, ReportType, RootIdError, RootNoteId,
+ builder_from_note, get_p_tags, send_mute_event, send_people_list_event, send_report_event,
+ send_unmute_event, BroadcastContext, ContextSelection, NoteAction, NoteContext,
+ NoteContextSelection, NoteRef, ReportTarget, ReportType, RootIdError, RootNoteId,
RootNoteIdBuf, ScrollInfo, ZapAction,
};
pub use notecache::{CachedNote, NoteCache};
diff --git a/crates/notedeck/src/note/context.rs b/crates/notedeck/src/note/context.rs
@@ -1,4 +1,4 @@
-use enostr::{NoteId, Pubkey, RelayId, RelayPool};
+use enostr::{NoteId, Pubkey, RelayId};
use nostrdb::{Ndb, Note, NoteKey, Transaction};
use tracing::error;
@@ -48,13 +48,11 @@ 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,
@@ -104,9 +102,23 @@ impl NoteContextSelection {
};
let muted = accounts.mute();
if muted.is_pk_muted(target.bytes()) {
- super::publish::send_unmute_event(ndb, txn, pool, kp, &muted, &target);
+ super::publish::send_unmute_event(
+ ndb,
+ txn,
+ &mut remote.publisher(accounts),
+ kp,
+ &muted,
+ &target,
+ );
} else {
- super::publish::send_mute_event(ndb, txn, pool, kp, &muted, &target);
+ super::publish::send_mute_event(
+ ndb,
+ txn,
+ &mut remote.publisher(accounts),
+ kp,
+ &muted,
+ &target,
+ );
}
}
NoteContextSelection::ReportUser => {}
diff --git a/crates/notedeck/src/note/mod.rs b/crates/notedeck/src/note/mod.rs
@@ -5,8 +5,8 @@ pub mod publish;
pub use action::{NoteAction, ReactAction, ScrollInfo, ZapAction, ZapTargetAmount};
pub use context::{BroadcastContext, ContextSelection, NoteContextSelection};
pub use publish::{
- builder_from_note, send_mute_event, send_note_builder, send_people_list_event,
- send_report_event, send_unmute_event, ReportTarget, ReportType,
+ builder_from_note, send_mute_event, send_people_list_event, send_report_event,
+ send_unmute_event, ReportTarget, ReportType,
};
use crate::jobs::MediaJobSender;
diff --git a/crates/notedeck/src/note/publish.rs b/crates/notedeck/src/note/publish.rs
@@ -1,4 +1,4 @@
-use enostr::{FilledKeypair, NoteId, Pubkey, RelayPool};
+use enostr::{FilledKeypair, NoteId, Pubkey};
use nostrdb::{Filter, Ndb, Note, NoteBuildOptions, NoteBuilder, Transaction};
use tracing::info;
@@ -83,27 +83,6 @@ where
builder
}
-pub fn send_note_builder(builder: NoteBuilder, ndb: &Ndb, pool: &mut RelayPool, kp: FilledKeypair) {
- let note = builder
- .sign(&kp.secret_key.secret_bytes())
- .build()
- .expect("build note");
-
- let Ok(event) = &enostr::ClientMessage::event(¬e) else {
- tracing::error!("send_note_builder: failed to build json");
- return;
- };
-
- let Ok(json) = event.to_json() else {
- tracing::error!("send_note_builder: failed to build json");
- return;
- };
-
- let _ = ndb.process_event_with(&json, nostrdb::IngestMetadata::new().client(true));
- info!("sending {}", &json);
- pool.send(event);
-}
-
pub fn publish_note_builder(
builder: NoteBuilder,
ndb: &Ndb,
@@ -133,7 +112,7 @@ pub fn publish_note_builder(
pub fn send_unmute_event(
ndb: &Ndb,
txn: &Transaction,
- pool: &mut RelayPool,
+ publisher: &mut PublishApi<'_, '_>,
kp: FilledKeypair,
muted: &Muted,
target: &Pubkey,
@@ -178,13 +157,13 @@ pub fn send_unmute_event(
}),
);
- send_note_builder(builder, ndb, pool, kp);
+ publish_note_builder(builder, ndb, publisher, kp);
}
pub fn send_mute_event(
ndb: &Ndb,
txn: &Transaction,
- pool: &mut RelayPool,
+ publisher: &mut PublishApi<'_, '_>,
kp: FilledKeypair,
muted: &Muted,
target: &Pubkey,
@@ -226,7 +205,7 @@ pub fn send_mute_event(
.tag_str(&target.hex())
};
- send_note_builder(builder, ndb, pool, kp);
+ publish_note_builder(builder, ndb, publisher, kp);
}
pub fn send_people_list_event(
@@ -256,7 +235,7 @@ pub fn send_people_list_event(
pub fn send_report_event(
ndb: &Ndb,
- pool: &mut RelayPool,
+ publisher: &mut PublishApi<'_, '_>,
kp: FilledKeypair,
target: &ReportTarget,
report_type: ReportType,
@@ -280,5 +259,5 @@ pub fn send_report_event(
.tag_str(report_str);
}
- send_note_builder(builder, ndb, pool, kp);
+ publish_note_builder(builder, ndb, publisher, kp);
}
diff --git a/crates/notedeck_columns/src/actionbar.rs b/crates/notedeck_columns/src/actionbar.rs
@@ -222,7 +222,7 @@ fn execute_note_action(
} else {
context
.action
- .process_selection(ui, ¬e, ndb, pool, remote, txn, accounts);
+ .process_selection(ui, ¬e, ndb, remote, txn, accounts);
}
}
},
diff --git a/crates/notedeck_columns/src/nav.rs b/crates/notedeck_columns/src/nav.rs
@@ -603,7 +603,6 @@ fn process_render_nav_action(
ctx.i18n,
ui.ctx(),
ctx.ndb,
- ctx.legacy_pool,
&mut ctx.remote,
ctx.accounts,
),
@@ -1184,7 +1183,13 @@ fn render_nav_body(
ui::report::ReportView::new(&mut app.view_state.selected_report_type).show(ui);
if let Some(report_type) = resp {
- notedeck::send_report_event(ctx.ndb, ctx.legacy_pool, kp, target, report_type);
+ notedeck::send_report_event(
+ ctx.ndb,
+ &mut ctx.remote.publisher(ctx.accounts),
+ kp,
+ target,
+ report_type,
+ );
app.view_state.selected_report_type = None;
return DragResponse::output(Some(RenderNavAction::Back));
}
diff --git a/crates/notedeck_columns/src/profile.rs b/crates/notedeck_columns/src/profile.rs
@@ -1,4 +1,4 @@
-use enostr::{FilledKeypair, FullKeypair, ProfileState, Pubkey, RelayPool};
+use enostr::{FilledKeypair, FullKeypair, ProfileState, Pubkey};
use nostrdb::{Ndb, Note, NoteBuildOptions, NoteBuilder, Transaction};
use notedeck::{
@@ -53,7 +53,6 @@ impl ProfileAction {
i18n: &mut Localization,
ctx: &egui::Context,
ndb: &Ndb,
- pool: &mut RelayPool,
remote: &mut RemoteApi<'_>,
accounts: &Accounts,
) -> Option<RouterAction> {
@@ -123,17 +122,25 @@ impl ProfileAction {
let kp = accounts.get_selected_account().key.to_full()?;
let muted = accounts.mute();
let txn = Transaction::new(ndb).expect("txn");
+ let publisher = &mut remote.publisher(accounts);
if muted.is_pk_muted(profile_context.profile.bytes()) {
notedeck::send_unmute_event(
ndb,
&txn,
- pool,
+ publisher,
kp,
&muted,
&profile_context.profile,
);
} else {
- send_mute_event(ndb, &txn, pool, kp, &muted, &profile_context.profile);
+ send_mute_event(
+ ndb,
+ &txn,
+ publisher,
+ kp,
+ &muted,
+ &profile_context.profile,
+ );
}
None
}