Support NIP-30 custom emoji in messages and reactions
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user