notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 926a3f80f4fc15ce200241c2d10d4f879d2958fe
parent e1a55c6532253c030128599a3ca132c7ef7b1bcf
Author: Ken Sedgwick <ken@bonsai.com>
Date:   Mon, 16 Dec 2024 16:20:47 -0800

ndb.get_notekey_by_id now returns NoteKey

Closes: https://github.com/damus-io/notedeck/pull/584

Diffstat:
Mcrates/notedeck/src/note.rs | 5+----
Mcrates/notedeck_columns/src/ui/thread.rs | 19++++++++-----------
2 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/crates/notedeck/src/note.rs b/crates/notedeck/src/note.rs @@ -49,10 +49,7 @@ pub fn root_note_id_from_selected_id<'a>( txn: &'a Transaction, selected_note_id: &'a [u8; 32], ) -> &'a [u8; 32] { - let selected_note_key = if let Ok(key) = ndb - .get_notekey_by_id(txn, selected_note_id) - .map(NoteKey::new) - { + let selected_note_key = if let Ok(key) = ndb.get_notekey_by_id(txn, selected_note_id) { key } else { return selected_note_id; diff --git a/crates/notedeck_columns/src/ui/thread.rs b/crates/notedeck_columns/src/ui/thread.rs @@ -5,7 +5,7 @@ use crate::{ ui::note::NoteOptions, }; -use nostrdb::{Ndb, NoteKey, Transaction}; +use nostrdb::{Ndb, Transaction}; use notedeck::{ImageCache, MuteFun, NoteCache, UnknownIds}; use tracing::error; @@ -54,16 +54,13 @@ impl<'a> ThreadView<'a> { pub fn ui(&mut self, ui: &mut egui::Ui, is_muted: &MuteFun) -> Option<NoteAction> { let txn = Transaction::new(self.ndb).expect("txn"); - let selected_note_key = if let Ok(key) = self - .ndb - .get_notekey_by_id(&txn, self.selected_note_id) - .map(NoteKey::new) - { - key - } else { - // TODO: render 404 ? - return None; - }; + let selected_note_key = + if let Ok(key) = self.ndb.get_notekey_by_id(&txn, self.selected_note_id) { + key + } else { + // TODO: render 404 ? + return None; + }; ui.label( egui::RichText::new("Threads ALPHA! It's not done. Things will be broken.")