diff --git a/crates/notedeck_columns/src/timeline/note_units.rs b/crates/notedeck_columns/src/timeline/note_units.rs index bdd61f4..6d74788 100644 --- a/crates/notedeck_columns/src/timeline/note_units.rs +++ b/crates/notedeck_columns/src/timeline/note_units.rs @@ -370,6 +370,7 @@ mod tests { reaction: Reaction { reaction: "+".to_owned(), sender: self.random_sender(), + sender_profilekey: None, }, })) } diff --git a/crates/notedeck_columns/src/timeline/timeline_units.rs b/crates/notedeck_columns/src/timeline/timeline_units.rs index cc10e35..74ee558 100644 --- a/crates/notedeck_columns/src/timeline/timeline_units.rs +++ b/crates/notedeck_columns/src/timeline/timeline_units.rs @@ -169,6 +169,11 @@ fn to_reaction<'a>( created_at: reacted_to_note.created_at(), }; + let sender_profilekey = ndb + .get_profile_by_pubkey(txn, payload.note.pubkey()) + .ok() + .and_then(|p| p.key()); + Some(ReactionResponse { fragment: ReactionFragment { noteref_reacted_to, @@ -176,6 +181,7 @@ fn to_reaction<'a>( reaction: Reaction { reaction: reaction.to_string(), sender: Pubkey::new(*payload.note.pubkey()), + sender_profilekey, }, }, pk: payload.note.pubkey(), diff --git a/crates/notedeck_columns/src/timeline/unit.rs b/crates/notedeck_columns/src/timeline/unit.rs index 1c4a8d4..49fca28 100644 --- a/crates/notedeck_columns/src/timeline/unit.rs +++ b/crates/notedeck_columns/src/timeline/unit.rs @@ -1,6 +1,7 @@ use std::collections::{BTreeMap, HashSet}; use enostr::Pubkey; +use nostrdb::ProfileKey; use notedeck::NoteRef; use crate::timeline::note_units::{CompositeKey, CompositeType, UnitKey}; @@ -275,6 +276,7 @@ impl ReactionFragment { pub struct Reaction { pub reaction: String, // can't use char because some emojis are 'grapheme clusters' pub sender: Pubkey, + pub sender_profilekey: Option, } /// Represents a singular repost diff --git a/crates/notedeck_columns/src/ui/timeline.rs b/crates/notedeck_columns/src/ui/timeline.rs index 914a5e9..cd2c33b 100644 --- a/crates/notedeck_columns/src/ui/timeline.rs +++ b/crates/notedeck_columns/src/ui/timeline.rs @@ -711,13 +711,16 @@ fn render_reaction_cluster( .reactions .values() .filter(|r| !mute.is_pk_muted(r.sender.bytes())) - .map(|r| &r.sender) - .map(|p| { - profiling::scope!("ndb by pubkey"); - ProfileEntry { - record: note_context.ndb.get_profile_by_pubkey(txn, p.bytes()).ok(), - pk: p, - } + .map(|r| (&r.sender, r.sender_profilekey)) + .map(|(p, key)| { + let record = if let Some(key) = key { + profiling::scope!("ndb by key"); + note_context.ndb.get_profile_by_key(txn, key).ok() + } else { + profiling::scope!("ndb by pubkey"); + note_context.ndb.get_profile_by_pubkey(txn, p.bytes()).ok() + }; + ProfileEntry { record, pk: p } }) .collect() };