Revert "feat: transitively trust images from parent note"

This reverts commit ea14713b58.
This commit is contained in:
kernelkind
2025-09-11 19:39:12 -04:00
parent a0e9c8b434
commit d6182ed7c3
3 changed files with 12 additions and 19 deletions

View File

@@ -410,7 +410,7 @@ impl<'a, 'd> PostView<'a, 'd> {
self.note_context, self.note_context,
txn, txn,
id.bytes(), id.bytes(),
None, nostrdb::NoteKey::new(0),
self.note_options, self.note_options,
self.jobs, self.jobs,
) )

View File

@@ -4,7 +4,7 @@ use crate::{
secondary_label, secondary_label,
}; };
use egui::{Color32, Hyperlink, Label, RichText}; use egui::{Color32, Hyperlink, Label, RichText};
use nostrdb::{BlockType, Mention, Note, Transaction}; use nostrdb::{BlockType, Mention, Note, NoteKey, Transaction};
use notedeck::Localization; use notedeck::Localization;
use notedeck::{time_format, update_imeta_blurhashes, NoteCache, NoteContext, NotedeckTextStyle}; use notedeck::{time_format, update_imeta_blurhashes, NoteCache, NoteContext, NotedeckTextStyle};
use notedeck::{JobsCache, RenderableMedia}; use notedeck::{JobsCache, RenderableMedia};
@@ -81,7 +81,7 @@ pub fn render_note_preview(
note_context: &mut NoteContext, note_context: &mut NoteContext,
txn: &Transaction, txn: &Transaction,
id: &[u8; 32], id: &[u8; 32],
parent: Option<&Note>, parent: NoteKey,
note_options: NoteOptions, note_options: NoteOptions,
jobs: &mut JobsCache, jobs: &mut JobsCache,
) -> NoteResponse { ) -> NoteResponse {
@@ -112,12 +112,10 @@ pub fn render_note_preview(
*/ */
}; };
let mut view = NoteView::new(note_context, &note, note_options, jobs).preview_style(); NoteView::new(note_context, &note, note_options, jobs)
if let Some(parent) = parent { .preview_style()
view = view.parent(parent); .parent(parent)
} .show(ui)
view.show(ui)
} }
/// Render note contents and surrounding info (client name, full date timestamp) /// 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, _)| { 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 .action
.map(|a| match a { .map(|a| match a {
NoteAction::Note { note_id, .. } => NoteAction::Note { NoteAction::Note { note_id, .. } => NoteAction::Note {

View File

@@ -32,7 +32,7 @@ use notedeck::{
pub struct NoteView<'a, 'd> { pub struct NoteView<'a, 'd> {
note_context: &'a mut NoteContext<'d>, note_context: &'a mut NoteContext<'d>,
parent: Option<&'a Note<'a>>, parent: Option<NoteKey>,
note: &'a nostrdb::Note<'a>, note: &'a nostrdb::Note<'a>,
flags: NoteOptions, flags: NoteOptions,
jobs: &'a mut JobsCache, jobs: &'a mut JobsCache,
@@ -85,7 +85,7 @@ impl<'a, 'd> NoteView<'a, 'd> {
flags: NoteOptions, flags: NoteOptions,
jobs: &'a mut JobsCache, jobs: &'a mut JobsCache,
) -> Self { ) -> Self {
let parent: Option<&Note> = None; let parent: Option<NoteKey> = None;
Self { Self {
note_context, note_context,
@@ -209,7 +209,7 @@ impl<'a, 'd> NoteView<'a, 'd> {
} }
#[inline] #[inline]
pub fn parent(mut self, parent: &'a Note<'a>) -> Self { pub fn parent(mut self, parent: NoteKey) -> Self {
self.parent = Some(parent); self.parent = Some(parent);
self self
} }
@@ -576,12 +576,7 @@ impl<'a, 'd> NoteView<'a, 'd> {
.ndb .ndb
.get_profile_by_pubkey(txn, self.note.pubkey()); .get_profile_by_pubkey(txn, self.note.pubkey());
let hitbox_id = note_hitbox_id( let hitbox_id = note_hitbox_id(note_key, self.options(), self.parent);
note_key,
self.options(),
self.parent
.map(|n| n.key().expect("todo: support non-db notes")),
);
let maybe_hitbox = maybe_note_hitbox(ui, hitbox_id); let maybe_hitbox = maybe_note_hitbox(ui, hitbox_id);
// wide design // wide design