Support NIP-30 custom emoji in messages and reactions

This commit is contained in:
2026-10-11 16:43:51 +07:00
parent 8a043b8d49
commit 6dad27469d
8 changed files with 250 additions and 30 deletions
+7 -1
View File
@@ -3,7 +3,7 @@ use std::time::Duration;
use anyhow::{Result, anyhow, bail};
use chat::Message;
use gpui::{App, AppContext, Context, EventEmitter, SharedString, Task};
use gpui::{App, AppContext, Context, EventEmitter, SharedString, SharedUri, Task};
use nostr_sdk::prelude::*;
use smallvec::{SmallVec, smallvec};
use state::NostrRegistry;
@@ -31,6 +31,7 @@ enum Absorbed {
pub struct Reaction {
pub id: EventId,
pub emoji: String,
pub image: Option<SharedUri>,
pub author: PublicKey,
}
@@ -756,9 +757,14 @@ impl Group {
return false;
}
let emojis = Message::emojis_from_tags(&event.tags);
let image = Message::reaction_image(&event.content, &emojis)
.map(|url| SharedUri::from(url.to_string()));
self.reactions.entry(target).or_default().push(Reaction {
id: event.id,
emoji: event.content.clone(),
image,
author: event.pubkey,
});