This commit is contained in:
2026-08-06 14:52:43 +07:00
parent 6d5d154486
commit 0c6d700395
4 changed files with 23 additions and 27 deletions
-5
View File
@@ -104,13 +104,8 @@ impl NostrBackend {
/// event is immediately visible to [`NostrBackend::query`].
pub async fn send(&self, builder: EventBuilder) -> Result<Event> {
let event = builder.finalize_async(&self.signer).await?;
let output = self.client.send_event(&event).await?;
// Keep our own events in the local database; the notification pump
// only fires for events received from relays.
self.client.database().save_event(&event).await?;
if output.success.is_empty() && !output.failed.is_empty() {
let reasons = output
.failed
+2 -7
View File
@@ -7,7 +7,7 @@ use nostr_sdk::prelude::*;
pub struct Update {
pub kind: Kind,
/// First `a` tag value of the event, if any (e.g. the repository coordinate).
pub coordinate: Option<String>,
pub coordinate: Option<Coordinate>,
pub author: PublicKey,
pub event_id: EventId,
}
@@ -15,12 +15,7 @@ pub struct Update {
impl Update {
/// Build an update from a received event.
pub fn from_event(event: &Event) -> Self {
let coordinate = event
.tags
.iter()
.find(|t| t.kind() == "a")
.and_then(|t| t.content())
.map(str::to_owned);
let coordinate = event.tags.coordinates().nth(0);
Self {
kind: event.kind,