feat: Don't SMTP-send messages to self-chat if BccSelf is disabled

`chat::create_send_msg_jobs()` already handles `Config::BccSelf` as needed. The only exception is
Autocrypt setup messages. This change unifies the logic for the self-chat and groups only containing
`SELF`.
This commit is contained in:
iequidoo
2024-09-14 23:11:29 -03:00
committed by iequidoo
parent b69488685f
commit 5b597f3a95
3 changed files with 17 additions and 2 deletions

View File

@@ -2107,6 +2107,19 @@ async fn test_no_unencrypted_name_in_self_chat() -> Result<()> {
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_no_smtp_job_for_self_chat() -> Result<()> {
let mut tcm = TestContextManager::new();
let bob = &tcm.bob().await;
bob.set_config_bool(Config::BccSelf, false).await?;
let chat_id = bob.get_self_chat().await.id;
let mut msg = Message::new(Viewtype::Text);
msg.text = "Happy birthday to me".to_string();
chat::send_msg(bob, chat_id, &mut msg).await?;
assert!(bob.pop_sent_msg_opt(Duration::ZERO).await.is_none());
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_outgoing_classic_mail_creates_chat() {
let alice = TestContext::new_alice().await;