feat: handle new message

This commit is contained in:
2025-01-12 12:39:05 +07:00
parent 7925db925e
commit 923966fb95
7 changed files with 199 additions and 507 deletions

View File

@@ -287,21 +287,8 @@ async fn main() {
});
}
Signal::Event(event) => {
let metadata = async_cx
.background_executor()
.spawn(async move {
if let Ok(metadata) =
client.database().metadata(event.pubkey).await
{
metadata.unwrap_or_default()
} else {
Metadata::new()
}
})
.await;
_ = async_cx.update_global::<ChatRegistry, _>(|chat, cx| {
chat.receive(event, metadata, cx)
_ = async_cx.update_global::<ChatRegistry, _>(|state, cx| {
state.receive(event, cx)
});
}
}