diff --git a/src/chat/chat_tests.rs b/src/chat/chat_tests.rs index 0848d6a2a..be630e85f 100644 --- a/src/chat/chat_tests.rs +++ b/src/chat/chat_tests.rs @@ -2902,6 +2902,16 @@ async fn test_broadcast_joining_golden() -> Result<()> { bob.golden_test_chat(bob_chat_id, "test_broadcast_joining_golden_bob") .await; + let alice_bob_contact = alice.add_or_lookup_contact_id(bob).await; + let direct_chat = ChatIdBlocked::lookup_by_contact(alice, alice_bob_contact) + .await? + .unwrap(); + // The 1:1 chat with Bob should not be visible to the user: + assert_eq!(direct_chat.blocked, Blocked::Yes); + alice + .golden_test_chat(direct_chat.id, "test_broadcast_joining_golden_alice_direct") + .await; + Ok(()) } @@ -3099,7 +3109,7 @@ async fn test_leave_broadcast_multidevice() -> Result<()> { let qr = get_securejoin_qr(alice, Some(alice_chat_id)).await.unwrap(); join_securejoin(bob0, &qr).await.unwrap(); let request = bob0.pop_sent_msg().await; - alice.recv_msg(&request).await; + alice.recv_msg_trash(&request).await; let answer = alice.pop_sent_msg().await; bob0.recv_msg(&answer).await; bob1.recv_msg(&answer).await; diff --git a/src/securejoin.rs b/src/securejoin.rs index 1732a89d8..d258c0b72 100644 --- a/src/securejoin.rs +++ b/src/securejoin.rs @@ -4,9 +4,7 @@ use anyhow::{Context as _, Error, Result, bail, ensure}; use deltachat_contact_tools::ContactAddress; use percent_encoding::{NON_ALPHANUMERIC, utf8_percent_encode}; -use crate::chat::{ - self, Chat, ChatId, ChatIdBlocked, ProtectionStatus, get_chat_id_by_grpid, -}; +use crate::chat::{self, Chat, ChatId, ChatIdBlocked, ProtectionStatus, get_chat_id_by_grpid}; use crate::chatlist_events; use crate::config::Config; use crate::constants::{Blocked, Chattype, NON_ALPHANUMERIC_WITHOUT_DOT}; @@ -443,11 +441,11 @@ pub(crate) async fn handle_securejoin_handshake( .await?; inviter_progress(context, contact_id, 800); inviter_progress(context, contact_id, 1000); - if step.starts_with("vb-") { + if step == "vb-request-v2" { // For broadcasts, we don't want to delete the message, // because the other device should also internally add the member // and see the key (because it won't see the member via autocrypt-gossip). - Ok(HandshakeMessage::Propagate) + Ok(HandshakeMessage::Ignore) } else { // IMAP-delete the message to avoid handling it by another device and adding the // member twice. Another device will know the member's key from Autocrypt-Gossip. diff --git a/test-data/golden/test_broadcast_joining_golden_alice_direct b/test-data/golden/test_broadcast_joining_golden_alice_direct new file mode 100644 index 000000000..3195f9571 --- /dev/null +++ b/test-data/golden/test_broadcast_joining_golden_alice_direct @@ -0,0 +1,4 @@ +Single#Chat#11: bob@example.net [KEY bob@example.net] 🛡️ +-------------------------------------------------------------------------------- +Msg#11: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO 🛡️] +--------------------------------------------------------------------------------