commit b7366351b60d0e47a2a5653db7c2a7d12cc4ef47
parent a04df88ff6e0afbe9e5c3135219d060ba6bb7143
Author: William Casarin <jb55@jb55.com>
Date: Mon, 1 Jul 2024 06:46:02 -0700
drafts: clear post after posting
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/draft.rs b/src/draft.rs
@@ -11,6 +11,12 @@ pub struct Drafts {
pub compose: Draft,
}
+impl Drafts {
+ pub fn clear(&mut self, source: DraftSource) {
+ source.draft(self).buffer = "".to_string();
+ }
+}
+
pub enum DraftSource<'a> {
Compose,
Reply(&'a [u8; 32]), // note id
diff --git a/src/timeline.rs b/src/timeline.rs
@@ -296,6 +296,7 @@ pub fn timeline_view(ui: &mut egui::Ui, app: &mut Damus, timeline: usize) {
let raw_msg = format!("[\"EVENT\",{}]", note.json().unwrap());
info!("sending {}", raw_msg);
app.pool.send(&enostr::ClientMessage::raw(raw_msg));
+ app.drafts.clear(DraftSource::Compose);
}
}
}