add NotePayload::noteref helper

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-09-04 15:06:48 -04:00
parent 571435cf85
commit f2258ab16b

View File

@@ -99,6 +99,15 @@ pub struct NotePayload<'a> {
pub key: NoteKey, pub key: NoteKey,
} }
impl<'a> NotePayload<'a> {
pub fn noteref(&self) -> NoteRef {
NoteRef {
key: self.key,
created_at: self.note.created_at(),
}
}
}
fn to_fragment<'a>( fn to_fragment<'a>(
payload: &'a NotePayload, payload: &'a NotePayload,
ndb: &Ndb, ndb: &Ndb,
@@ -147,10 +156,7 @@ fn to_reaction<'a>(
let reacted_to_noteid = note_reacted_to?; let reacted_to_noteid = note_reacted_to?;
let reaction_note_ref = NoteRef { let reaction_note_ref = payload.noteref();
key: payload.key,
created_at: payload.note.created_at(),
};
let reacted_to_note = ndb.get_note_by_id(txn, reacted_to_noteid).ok()?; let reacted_to_note = ndb.get_note_by_id(txn, reacted_to_noteid).ok()?;