harden proxy auth and event ordering
This commit is contained in:
@@ -598,16 +598,23 @@ impl ChatPanel {
|
||||
return;
|
||||
}
|
||||
|
||||
let content = SharedString::from(&event.content);
|
||||
let emojis = emojis_from_tags(&event.tags);
|
||||
|
||||
let image = Message::reaction_image(&event.content, &emojis)
|
||||
.map(|url| SharedUri::from(url.to_string()));
|
||||
|
||||
for id in event.tags.event_ids() {
|
||||
self.reactions.entry(id).or_default().push((
|
||||
SharedString::from(&event.content),
|
||||
image.clone(),
|
||||
event.pubkey,
|
||||
));
|
||||
let entries = self.reactions.entry(id).or_default();
|
||||
// NIP-25: a newer reaction by the same author replaces their previous one
|
||||
if let Some(existing) = entries
|
||||
.iter_mut()
|
||||
.find(|(_, _, author)| *author == event.pubkey)
|
||||
{
|
||||
*existing = (content.clone(), image.clone(), event.pubkey);
|
||||
} else {
|
||||
entries.push((content.clone(), image.clone(), event.pubkey));
|
||||
}
|
||||
}
|
||||
|
||||
cx.notify();
|
||||
|
||||
Reference in New Issue
Block a user