mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
fix: fix flaky tests::verified_chats::test_verified_chat_editor_reordering and receive_imf::receive_imf_tests::test_two_group_securejoins
Flakiness was introduced in e7348a4fd8.
This change removes a call to joining_chat_id() which created a chat,
now we check for existing group chat
without creating it if it does not exist.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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]
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user