notedeck

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

commit d6182ed7c329edd20158bf63d99ccf43fd007339
parent a0e9c8b4346f1089cc6c315ebe03517206d96c72
Author: kernelkind <kernelkind@gmail.com>
Date:   Thu, 11 Sep 2025 19:39:12 -0400

Revert "feat: transitively trust images from parent note"

This reverts commit ea14713b58721a2373e50a410eaa3b1339c22536.

Diffstat:
Mcrates/notedeck_columns/src/ui/note/post.rs | 2+-
Mcrates/notedeck_ui/src/note/contents.rs | 16+++++++---------
Mcrates/notedeck_ui/src/note/mod.rs | 13++++---------
3 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/crates/notedeck_columns/src/ui/note/post.rs b/crates/notedeck_columns/src/ui/note/post.rs @@ -410,7 +410,7 @@ impl<'a, 'd> PostView<'a, 'd> { self.note_context, txn, id.bytes(), - None, + nostrdb::NoteKey::new(0), self.note_options, self.jobs, ) diff --git a/crates/notedeck_ui/src/note/contents.rs b/crates/notedeck_ui/src/note/contents.rs @@ -4,7 +4,7 @@ use crate::{ secondary_label, }; use egui::{Color32, Hyperlink, Label, RichText}; -use nostrdb::{BlockType, Mention, Note, Transaction}; +use nostrdb::{BlockType, Mention, Note, NoteKey, Transaction}; use notedeck::Localization; use notedeck::{time_format, update_imeta_blurhashes, NoteCache, NoteContext, NotedeckTextStyle}; use notedeck::{JobsCache, RenderableMedia}; @@ -81,7 +81,7 @@ pub fn render_note_preview( note_context: &mut NoteContext, txn: &Transaction, id: &[u8; 32], - parent: Option<&Note>, + parent: NoteKey, note_options: NoteOptions, jobs: &mut JobsCache, ) -> NoteResponse { @@ -112,12 +112,10 @@ pub fn render_note_preview( */ }; - let mut view = NoteView::new(note_context, &note, note_options, jobs).preview_style(); - if let Some(parent) = parent { - view = view.parent(parent); - } - - view.show(ui) + NoteView::new(note_context, &note, note_options, jobs) + .preview_style() + .parent(parent) + .show(ui) } /// Render note contents and surrounding info (client name, full date timestamp) @@ -357,7 +355,7 @@ fn render_undecorated_note_contents<'a>( }); let preview_note_action = inline_note.and_then(|(id, _)| { - render_note_preview(ui, note_context, txn, id, Some(note), options, jobs) + render_note_preview(ui, note_context, txn, id, note_key, options, jobs) .action .map(|a| match a { NoteAction::Note { note_id, .. } => NoteAction::Note { diff --git a/crates/notedeck_ui/src/note/mod.rs b/crates/notedeck_ui/src/note/mod.rs @@ -32,7 +32,7 @@ use notedeck::{ pub struct NoteView<'a, 'd> { note_context: &'a mut NoteContext<'d>, - parent: Option<&'a Note<'a>>, + parent: Option<NoteKey>, note: &'a nostrdb::Note<'a>, flags: NoteOptions, jobs: &'a mut JobsCache, @@ -85,7 +85,7 @@ impl<'a, 'd> NoteView<'a, 'd> { flags: NoteOptions, jobs: &'a mut JobsCache, ) -> Self { - let parent: Option<&Note> = None; + let parent: Option<NoteKey> = None; Self { note_context, @@ -209,7 +209,7 @@ impl<'a, 'd> NoteView<'a, 'd> { } #[inline] - pub fn parent(mut self, parent: &'a Note<'a>) -> Self { + pub fn parent(mut self, parent: NoteKey) -> Self { self.parent = Some(parent); self } @@ -576,12 +576,7 @@ impl<'a, 'd> NoteView<'a, 'd> { .ndb .get_profile_by_pubkey(txn, self.note.pubkey()); - let hitbox_id = note_hitbox_id( - note_key, - self.options(), - self.parent - .map(|n| n.key().expect("todo: support non-db notes")), - ); + let hitbox_id = note_hitbox_id(note_key, self.options(), self.parent); let maybe_hitbox = maybe_note_hitbox(ui, hitbox_id); // wide design