mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-24 03:24:21 +01:00
enostr: remove raw event type
we rely on the event type for multicast logic, so remove raw since its not really needed anymore Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -38,10 +38,6 @@ impl ClientMessage {
|
||||
Ok(ClientMessage::Event(EventClientMessage { note_json }))
|
||||
}
|
||||
|
||||
pub fn raw(raw: String) -> Self {
|
||||
ClientMessage::Raw(raw)
|
||||
}
|
||||
|
||||
pub fn req(sub_id: String, filters: Vec<Filter>) -> Self {
|
||||
ClientMessage::Req { sub_id, filters }
|
||||
}
|
||||
|
||||
@@ -50,15 +50,22 @@ impl ProfileAction {
|
||||
match self {
|
||||
ProfileAction::Edit(kp) => Some(RouterAction::route_to(Route::EditProfile(kp.pubkey))),
|
||||
ProfileAction::SaveChanges(changes) => {
|
||||
let raw_msg = format!("[\"EVENT\",{}]", changes.to_note().json().unwrap());
|
||||
let note = changes.to_note();
|
||||
let Ok(event) = enostr::ClientMessage::event(¬e) else {
|
||||
tracing::error!("could not serialize profile note?");
|
||||
return None;
|
||||
};
|
||||
|
||||
let _ = ndb.process_event_with(
|
||||
raw_msg.as_str(),
|
||||
nostrdb::IngestMetadata::new().client(true),
|
||||
);
|
||||
let Ok(json) = event.to_json() else {
|
||||
tracing::error!("could not serialize profile note?");
|
||||
return None;
|
||||
};
|
||||
|
||||
info!("sending {}", raw_msg);
|
||||
pool.send(&enostr::ClientMessage::raw(raw_msg));
|
||||
// TODO(jb55): do this in a more centralized place
|
||||
let _ = ndb.process_event_with(&json, nostrdb::IngestMetadata::new().client(true));
|
||||
|
||||
info!("sending {}", &json);
|
||||
pool.send(&event);
|
||||
|
||||
Some(RouterAction::GoBack)
|
||||
}
|
||||
@@ -195,14 +202,19 @@ fn send_note_builder(builder: NoteBuilder, ndb: &Ndb, pool: &mut RelayPool, kp:
|
||||
.build()
|
||||
.expect("build note");
|
||||
|
||||
let raw_msg = format!("[\"EVENT\",{}]", note.json().unwrap());
|
||||
let Ok(event) = &enostr::ClientMessage::event(¬e) else {
|
||||
tracing::error!("send_note_builder: failed to build json");
|
||||
return;
|
||||
};
|
||||
|
||||
let _ = ndb.process_event_with(
|
||||
raw_msg.as_str(),
|
||||
nostrdb::IngestMetadata::new().client(true),
|
||||
);
|
||||
info!("sending {}", raw_msg);
|
||||
pool.send(&enostr::ClientMessage::raw(raw_msg));
|
||||
let Ok(json) = event.to_json() else {
|
||||
tracing::error!("send_note_builder: failed to build json");
|
||||
return;
|
||||
};
|
||||
|
||||
let _ = ndb.process_event_with(&json, nostrdb::IngestMetadata::new().client(true));
|
||||
info!("sending {}", &json);
|
||||
pool.send(event);
|
||||
}
|
||||
|
||||
pub fn send_new_contact_list(kp: FilledKeypair, ndb: &Ndb, pool: &mut RelayPool) {
|
||||
|
||||
Reference in New Issue
Block a user