fix: MimeFactory::verified: Return true for self-chat

For purposes of building a message it's better to consider the self-chat as verified. Particularly,
this removes unencrypted name from the "From" header.
This commit is contained in:
iequidoo
2024-07-08 16:36:48 -03:00
committed by iequidoo
parent a2dacc333c
commit 9a6147b643
2 changed files with 18 additions and 13 deletions

View File

@@ -2094,6 +2094,18 @@ Message content",
assert_ne!(msg.chat_id, t.get_self_chat().await.id);
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_no_unencrypted_name_in_self_chat() -> Result<()> {
let mut tcm = TestContextManager::new();
let bob = &tcm.bob().await;
bob.set_config(Config::Displayname, Some("Bob Smith"))
.await?;
let chat_id = bob.get_self_chat().await.id;
let msg = bob.send_text(chat_id, "Happy birthday to me").await;
assert_eq!(msg.payload.contains("Bob Smith"), false);
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_outgoing_classic_mail_creates_chat() {
let alice = TestContext::new_alice().await;