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();
notedeck_columns::actionbar::execute_and_process_note_action(
&note_action,
note_action,
ctx.ndb,
columns
.decks_cache

View File

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

View File

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