fix: harden uploaded attachment retention and replay

This commit is contained in:
2026-09-03 05:50:47 +09:00
parent 6c5b8315a3
commit 8a70f3cb26
14 changed files with 321 additions and 29 deletions
-8
View File
@@ -928,14 +928,6 @@ impl App {
Some(self.method_for_run(queued.segments))
}
pub fn push_notice(&mut self, message: impl Into<String>) {
self.blocks.push(Block::Alert {
level: AlertLevel::Warn,
source: AlertSource::Worker,
message: message.into(),
});
}
pub fn push_error(&mut self, message: impl Into<String>) {
self.blocks.push(Block::Alert {
level: AlertLevel::Error,
+15 -5
View File
@@ -792,17 +792,27 @@ async fn handle_terminal_event<T: Socket>(
if let Some(method) = handle_key(app, key) {
if let Some(path) = attachment_command_path(&method) {
match client.upload_path(&path).await {
Ok(reference) => app.push_notice(format!(
"Attached {} ({} bytes); it will be sent with the next message.",
reference.file_name, reference.byte_len
)),
Ok(reference) => app.flash_actionbar_notice(
format!(
"Attached {} ({} bytes); it will be sent with the next message.",
reference.file_name, reference.byte_len
),
ActionbarNoticeLevel::Info,
ActionbarNoticeSource::Tui,
Duration::from_secs(6),
),
Err(error) => {
app.push_error(format!("Attachment upload failed: {error}"));
}
}
} else if is_clear_attachments_command(&method) {
client.clear_pending_attachments().await;
app.push_notice("Removed pending attachments.");
app.flash_actionbar_notice(
"Removed pending attachments.",
ActionbarNoticeLevel::Info,
ActionbarNoticeSource::Tui,
Duration::from_secs(4),
);
} else {
client.send(&method).await?;
}