commit f2adb949f658d4740b5e8f1f8e0138e837d80f00
parent 6f266fc91dc1164fbd9e226d66ddb32008557056
Author: William Casarin <jb55@jb55.com>
Date: Tue, 15 Jul 2025 09:29:21 -0700
columns/nav: ocd nevernest
no behavior changed
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 32 insertions(+), 30 deletions(-)
diff --git a/crates/notedeck_columns/src/nav.rs b/crates/notedeck_columns/src/nav.rs
@@ -668,40 +668,42 @@ fn render_nav_body(
}
Route::EditProfile(pubkey) => {
let mut action = None;
- if let Some(kp) = ctx.accounts.get_full(pubkey) {
- let state = app
- .view_state
- .pubkey_to_profile_state
- .entry(*kp.pubkey)
- .or_insert_with(|| {
- let txn = Transaction::new(ctx.ndb).expect("txn");
- let filter = Filter::new_with_capacity(1)
- .kinds([0])
- .authors([kp.pubkey.bytes()])
- .build();
-
- let Ok(results) = ctx.ndb.query(&txn, &[filter], 1) else {
- return ProfileState::default();
- };
+ let Some(kp) = ctx.accounts.get_full(pubkey) else {
+ error!("Pubkey in EditProfile route did not have an nsec attached in Accounts");
+ return None;
+ };
- if let Some(result) = results.first() {
- ProfileState::from_note_contents(result.note.content())
- } else {
- ProfileState::default()
- }
- });
- if EditProfileView::new(state, ctx.img_cache).ui(ui) {
- if let Some(taken_state) =
- app.view_state.pubkey_to_profile_state.remove(kp.pubkey)
- {
- action = Some(RenderNavAction::ProfileAction(ProfileAction::SaveChanges(
- SaveProfileChanges::new(kp.to_full(), taken_state),
- )))
+ let state = app
+ .view_state
+ .pubkey_to_profile_state
+ .entry(*kp.pubkey)
+ .or_insert_with(|| {
+ let txn = Transaction::new(ctx.ndb).expect("txn");
+ let filter = Filter::new_with_capacity(1)
+ .kinds([0])
+ .authors([kp.pubkey.bytes()])
+ .build();
+
+ let Ok(results) = ctx.ndb.query(&txn, &[filter], 1) else {
+ return ProfileState::default();
+ };
+
+ if let Some(result) = results.first() {
+ ProfileState::from_note_contents(result.note.content())
+ } else {
+ ProfileState::default()
}
+ });
+
+ if EditProfileView::new(state, ctx.img_cache).ui(ui) {
+ if let Some(taken_state) = app.view_state.pubkey_to_profile_state.remove(kp.pubkey)
+ {
+ action = Some(RenderNavAction::ProfileAction(ProfileAction::SaveChanges(
+ SaveProfileChanges::new(kp.to_full(), taken_state),
+ )))
}
- } else {
- error!("Pubkey in EditProfile route did not have an nsec attached in Accounts");
}
+
action
}
Route::Wallet(wallet_type) => {