diff --git a/src/securejoin/bob.rs b/src/securejoin/bob.rs index 4a8d805a6..f276e8e02 100644 --- a/src/securejoin/bob.rs +++ b/src/securejoin/bob.rs @@ -65,11 +65,26 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul ) .await?; - // Chat ID of the group we are joining, unused otherwise. - let group_chat_id = joining_chat_id(context, &invite, chat_id).await?; - if matches!(invite, QrInvite::Group { .. }) - && is_contact_in_chat(context, group_chat_id, ContactId::SELF).await? - { + // `group_chat_id` is `Some` if group chat + // already exists and we are in the chat. + let group_chat_id = match invite { + QrInvite::Group { ref grpid, .. } => { + if let Some((group_chat_id, _blocked)) = + chat::get_chat_id_by_grpid(context, grpid).await? + { + if is_contact_in_chat(context, group_chat_id, ContactId::SELF).await? { + Some(group_chat_id) + } else { + None + } + } else { + None + } + } + QrInvite::Contact { .. } => None, + }; + + if let Some(group_chat_id) = group_chat_id { // If QR code is a group invite // and we are already in the chat, // nothing needs to be done. diff --git a/test-data/golden/two_group_securejoins b/test-data/golden/two_group_securejoins index 1e857fa60..5e20c36b6 100644 --- a/test-data/golden/two_group_securejoins +++ b/test-data/golden/two_group_securejoins @@ -4,6 +4,6 @@ Msg#6004: info (Contact#Contact#Info): alice@example.org invited you to join thi Waiting for the device of alice@example.org to reply… [NOTICED][INFO] Msg#6006: info (Contact#Contact#Info): alice@example.org replied, waiting for being added to the group… [NOTICED][INFO] -Msg#6002: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO] +Msg#6003: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO] Msg#6008🔒: (Contact#Contact#6001): Member Me added by alice@example.org. [FRESH][INFO] -------------------------------------------------------------------------------- diff --git a/test-data/golden/verified_chats_editor_reordering b/test-data/golden/verified_chats_editor_reordering index a7e5b75d7..3bf488c00 100644 --- a/test-data/golden/verified_chats_editor_reordering +++ b/test-data/golden/verified_chats_editor_reordering @@ -4,7 +4,7 @@ Msg#3004: info (Contact#Contact#Info): alice@example.org invited you to join thi Waiting for the device of alice@example.org to reply… [NOTICED][INFO] Msg#3006: info (Contact#Contact#Info): alice@example.org replied, waiting for being added to the group… [NOTICED][INFO] -Msg#3002: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO] +Msg#3003: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO] Msg#3008🔒: (Contact#Contact#3002): [FRESH] Msg#3009: info (Contact#Contact#Info): Member bob@example.net added. [NOTICED][INFO] Msg#3010🔒: (Contact#Contact#3001): Member Me added by alice@example.org. [FRESH][INFO]