fix: make email tracking and draft saving non-fatal for bots without those tables
All checks were successful
BotServer CI/CD / build (push) Successful in 4m43s

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-04 18:13:46 -03:00
parent 01db253900
commit 3f3ecc5320

View file

@ -332,7 +332,9 @@ async fn execute_send_mail(
) -> Result<String, String> { ) -> Result<String, String> {
let message_id = Uuid::new_v4().to_string(); let message_id = Uuid::new_v4().to_string();
track_email(state, user, &message_id, to, subject, "sent")?; track_email(state, user, &message_id, to, subject, "sent").unwrap_or_else(|e| {
log::warn!("Email tracking skipped (table may not exist): {}", e);
});
if let Some(account_email) = using_account { if let Some(account_email) = using_account {
let creds = get_account_credentials(&state.conn, &account_email, user.bot_id) let creds = get_account_credentials(&state.conn, &account_email, user.bot_id)
@ -367,7 +369,9 @@ async fn execute_send_mail(
} }
} }
save_email_draft(state, user, to, subject, body, attachments)?; save_email_draft(state, user, to, subject, body, attachments).unwrap_or_else(|e| {
log::warn!("Email draft not saved (table may not exist): {}", e);
});
Ok(format!("Email saved as draft: {}", message_id)) Ok(format!("Email saved as draft: {}", message_id))
} }