fix redundant copy saved

This commit is contained in:
Clément DOUIN 2023-12-20 16:43:33 +01:00
parent 92a94c8ff1
commit 2351cfdd28
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72
4 changed files with 7 additions and 12 deletions

4
Cargo.lock generated
View file

@ -1216,9 +1216,9 @@ dependencies = [
[[package]]
name = "email-lib"
version = "0.18.3"
version = "0.18.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80f52a4d9fbc807cc601e6cbc00e5e5cc40d8f6e3f0601ccdca568ec236019cb"
checksum = "3866f59bba6a9bf58a3ee573c0dd111401b9012f3438c912e1fb2563bbc2eae9"
dependencies = [
"advisory-lock",
"anyhow",

View file

@ -50,7 +50,7 @@ clap_mangen = "0.2"
console = "0.15.2"
dialoguer = "0.10.2"
dirs = "4.0"
email-lib = { version = "=0.18.3", default-features = false }
email-lib = { version = "=0.18.4", default-features = false }
email_address = "0.2.4"
env_logger = "0.8"
erased-serde = "0.3"

View file

@ -70,6 +70,8 @@ impl MessageReplyCommand {
.build()
.await?;
editor::edit_tpl_with_editor(&account_config, printer, &backend, tpl).await?;
// TODO: let backend.send_reply_raw_message adding the flag
backend.add_flag(&folder, &[id], Flag::Answered).await
}
}

View file

@ -3,7 +3,7 @@ use email::{
account::config::AccountConfig,
email::utils::{local_draft_path, remove_local_draft},
flag::{Flag, Flags},
folder::{DRAFTS, SENT},
folder::DRAFTS,
};
use log::debug;
use mml::MmlCompilerBuilder;
@ -45,7 +45,7 @@ pub async fn open_with_local_draft() -> Result<String> {
}
pub async fn edit_tpl_with_editor<P: Printer>(
config: &AccountConfig,
#[allow(unused)] config: &AccountConfig,
printer: &mut P,
backend: &Backend,
mut tpl: String,
@ -90,13 +90,6 @@ pub async fn edit_tpl_with_editor<P: Printer>(
backend.send_raw_message(&email).await?;
if config.should_save_copy_sent_message() {
printer.print_log("Adding email to the Sent folder…")?;
backend
.add_raw_message_with_flag(SENT, &email, Flag::Seen)
.await?;
}
remove_local_draft()?;
printer.print("Done!")?;
break;