diff --git a/src/chat.rs b/src/chat.rs index 46d8e3a6ee..7587d9b4d0 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -2593,10 +2593,12 @@ impl ChatIdBlocked { _ => (), } - let peerstate = Peerstate::from_addr(context, contact.get_addr()).await?; - let protected = peerstate.map_or(false, |p| { - p.is_using_verified_key() && p.prefer_encrypt == EncryptPreference::Mutual - }); + let protected = contact_id == ContactId::SELF || { + let peerstate = Peerstate::from_addr(context, contact.get_addr()).await?; + peerstate.is_some_and(|p| { + p.is_using_verified_key() && p.prefer_encrypt == EncryptPreference::Mutual + }) + }; let smeared_time = create_smeared_timestamp(context); let chat_id = context diff --git a/src/contact.rs b/src/contact.rs index 7e925cd1c7..8baf90c6e9 100644 --- a/src/contact.rs +++ b/src/contact.rs @@ -3244,4 +3244,20 @@ Until the false-positive is fixed: Ok(()) } + + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] + async fn test_self_is_verified() -> Result<()> { + let mut tcm = TestContextManager::new(); + let alice = tcm.alice().await; + + let contact = Contact::get_by_id(&alice, ContactId::SELF).await?; + assert_eq!(contact.is_verified(&alice).await?, true); + assert!(contact.is_profile_verified(&alice).await?); + assert!(contact.get_verifier_id(&alice).await?.is_none()); + + let chat_id = ChatId::get_for_contact(&alice, ContactId::SELF).await?; + assert!(chat_id.is_protected(&alice).await.unwrap() == ProtectionStatus::Protected); + + Ok(()) + } }