-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add info messages about implicit membership changes if group me…
…mber list is recreated (#6314)
- Loading branch information
Showing
4 changed files
with
80 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4145,7 +4145,7 @@ async fn test_dont_recreate_contacts_on_add_remove() -> Result<()> { | |
} | ||
|
||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] | ||
async fn test_recreate_contact_list_on_missing_message() -> Result<()> { | ||
async fn test_recreate_contact_list_on_missing_messages() -> Result<()> { | ||
let alice = TestContext::new_alice().await; | ||
let bob = TestContext::new_bob().await; | ||
let chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "Group").await?; | ||
|
@@ -4170,25 +4170,33 @@ async fn test_recreate_contact_list_on_missing_message() -> Result<()> { | |
remove_contact_from_chat(&bob, bob_chat_id, bob_contact_fiona).await?; | ||
let remove_msg = bob.pop_sent_msg().await; | ||
|
||
// bob adds a new member | ||
// bob adds new members | ||
let bob_blue = Contact::create(&bob, "blue", "[email protected]").await?; | ||
add_contact_to_chat(&bob, bob_chat_id, bob_blue).await?; | ||
|
||
bob.pop_sent_msg().await; | ||
let bob_orange = Contact::create(&bob, "orange", "[email protected]").await?; | ||
add_contact_to_chat(&bob, bob_chat_id, bob_orange).await?; | ||
let add_msg = bob.pop_sent_msg().await; | ||
|
||
// alice only receives the addition of the member | ||
// alice only receives the second member addition | ||
alice.recv_msg(&add_msg).await; | ||
|
||
// since we missed a message, a new contact list should be build | ||
assert_eq!(get_chat_contacts(&alice, chat_id).await?.len(), 3); | ||
// since we missed messages, a new contact list should be build | ||
assert_eq!(get_chat_contacts(&alice, chat_id).await?.len(), 4); | ||
|
||
// re-add fiona | ||
add_contact_to_chat(&alice, chat_id, alice_fiona).await?; | ||
|
||
// delayed removal of fiona shouldn't remove her | ||
alice.recv_msg_trash(&remove_msg).await; | ||
assert_eq!(get_chat_contacts(&alice, chat_id).await?.len(), 4); | ||
assert_eq!(get_chat_contacts(&alice, chat_id).await?.len(), 5); | ||
|
||
alice | ||
.golden_test_chat( | ||
chat_id, | ||
"receive_imf_recreate_contact_list_on_missing_messages", | ||
) | ||
.await; | ||
Ok(()) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
test-data/golden/receive_imf_recreate_contact_list_on_missing_messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Group#Chat#10: Group [5 member(s)] | ||
-------------------------------------------------------------------------------- | ||
Msg#10: Me (Contact#Contact#Self): populate √ | ||
Msg#11: info (Contact#Contact#Info): Member [email protected] added. [NOTICED][INFO] | ||
Msg#12: info (Contact#Contact#Info): Member fiona ([email protected]) removed. [NOTICED][INFO] | ||
Msg#13: bob (Contact#Contact#11): Member [email protected] added by bob ([email protected]). [FRESH][INFO] | ||
Msg#14: Me (Contact#Contact#Self): You added member fiona ([email protected]). [INFO] o | ||
-------------------------------------------------------------------------------- |