Merge a bunch of fixes by kernel

kernelkind (3):
      fix: can upload photo from reply or quote
      fix: image shimmer bug
      feat: transitively trust images from parent note
This commit is contained in:
William Casarin
2025-09-10 12:06:01 -07:00
4 changed files with 65 additions and 31 deletions

View File

@@ -32,7 +32,7 @@ use notedeck::{
pub struct NoteView<'a, 'd> {
note_context: &'a mut NoteContext<'d>,
parent: Option<NoteKey>,
parent: Option<&'a Note<'a>>,
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<NoteKey> = None;
let parent: Option<&Note> = None;
Self {
note_context,
@@ -209,7 +209,7 @@ impl<'a, 'd> NoteView<'a, 'd> {
}
#[inline]
pub fn parent(mut self, parent: NoteKey) -> Self {
pub fn parent(mut self, parent: &'a Note<'a>) -> Self {
self.parent = Some(parent);
self
}
@@ -255,6 +255,7 @@ impl<'a, 'd> NoteView<'a, 'd> {
self.note_context,
txn,
self.note,
self.parent,
self.flags,
self.jobs,
));
@@ -425,8 +426,14 @@ impl<'a, 'd> NoteView<'a, 'd> {
});
}
let mut contents =
NoteContents::new(self.note_context, txn, self.note, self.flags, self.jobs);
let mut contents = NoteContents::new(
self.note_context,
txn,
self.note,
self.parent,
self.flags,
self.jobs,
);
ui.add(&mut contents);
@@ -519,8 +526,14 @@ impl<'a, 'd> NoteView<'a, 'd> {
});
}
let mut contents =
NoteContents::new(self.note_context, txn, self.note, self.flags, self.jobs);
let mut contents = NoteContents::new(
self.note_context,
txn,
self.note,
self.parent,
self.flags,
self.jobs,
);
ui.add(&mut contents);
note_action = contents.action.or(note_action);
@@ -564,7 +577,12 @@ 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);
let hitbox_id = note_hitbox_id(
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);
// wide design