pass NoteAction by value instead of reference

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-04-29 13:22:53 -04:00
parent 953496fc74
commit e7c3755a08
3 changed files with 10 additions and 16 deletions

View File

@@ -501,7 +501,7 @@ fn chrome_handle_app_action(
let txn = Transaction::new(ctx.ndb).unwrap(); let txn = Transaction::new(ctx.ndb).unwrap();
notedeck_columns::actionbar::execute_and_process_note_action( notedeck_columns::actionbar::execute_and_process_note_action(
&note_action, note_action,
ctx.ndb, ctx.ndb,
columns columns
.decks_cache .decks_cache

View File

@@ -24,7 +24,7 @@ pub enum TimelineOpenResult {
/// The note action executor for notedeck_columns /// The note action executor for notedeck_columns
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
fn execute_note_action( fn execute_note_action(
action: &NoteAction, action: NoteAction,
ndb: &Ndb, ndb: &Ndb,
router: &mut Router<Route>, router: &mut Router<Route>,
timeline_cache: &mut TimelineCache, timeline_cache: &mut TimelineCache,
@@ -38,19 +38,18 @@ fn execute_note_action(
) -> Option<TimelineOpenResult> { ) -> Option<TimelineOpenResult> {
match action { match action {
NoteAction::Reply(note_id) => { NoteAction::Reply(note_id) => {
router.route_to(Route::reply(*note_id)); router.route_to(Route::reply(note_id));
None None
} }
NoteAction::Profile(pubkey) => { NoteAction::Profile(pubkey) => {
let kind = TimelineKind::Profile(*pubkey); let kind = TimelineKind::Profile(pubkey);
router.route_to(Route::Timeline(kind.clone())); router.route_to(Route::Timeline(kind.clone()));
timeline_cache.open(ndb, note_cache, txn, pool, &kind) timeline_cache.open(ndb, note_cache, txn, pool, &kind)
} }
NoteAction::Note(note_id) => 'ex: { NoteAction::Note(note_id) => 'ex: {
let Ok(thread_selection) = let Ok(thread_selection) = ThreadSelection::from_note_id(ndb, note_cache, txn, note_id)
ThreadSelection::from_note_id(ndb, note_cache, txn, *note_id)
else { else {
tracing::error!("No thread selection for {}?", hex::encode(note_id.bytes())); tracing::error!("No thread selection for {}?", hex::encode(note_id.bytes()));
break 'ex None; break 'ex None;
@@ -70,7 +69,7 @@ fn execute_note_action(
} }
NoteAction::Quote(note_id) => { NoteAction::Quote(note_id) => {
router.route_to(Route::quote(*note_id)); router.route_to(Route::quote(note_id));
None None
} }
@@ -81,7 +80,7 @@ fn execute_note_action(
let sender = cur_acc.key.pubkey; let sender = cur_acc.key.pubkey;
match zap_action { match &zap_action {
ZapAction::Send(target) => 'a: { ZapAction::Send(target) => 'a: {
let Some(wallet) = get_wallet_for_mut(accounts, global_wallet, sender.bytes()) let Some(wallet) = get_wallet_for_mut(accounts, global_wallet, sender.bytes())
else { else {
@@ -122,7 +121,7 @@ fn execute_note_action(
/// Execute a NoteAction and process the result /// Execute a NoteAction and process the result
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
pub fn execute_and_process_note_action( pub fn execute_and_process_note_action(
action: &NoteAction, action: NoteAction,
ndb: &Ndb, ndb: &Ndb,
columns: &mut Columns, columns: &mut Columns,
col: usize, col: usize,

View File

@@ -134,7 +134,7 @@ impl RenderNavResponse {
#[must_use = "Make sure to save columns if result is true"] #[must_use = "Make sure to save columns if result is true"]
pub fn process_render_nav_response( pub fn process_render_nav_response(
&self, self,
app: &mut Damus, app: &mut Damus,
ctx: &mut AppContext<'_>, ctx: &mut AppContext<'_>,
ui: &mut egui::Ui, ui: &mut egui::Ui,
@@ -142,12 +142,7 @@ impl RenderNavResponse {
let mut switching_occured: bool = false; let mut switching_occured: bool = false;
let col = self.column; let col = self.column;
if let Some(action) = self if let Some(action) = self.response.response.or(self.response.title_response) {
.response
.response
.as_ref()
.or(self.response.title_response.as_ref())
{
// start returning when we're finished posting // start returning when we're finished posting
match action { match action {
RenderNavAction::Back => { RenderNavAction::Back => {