From 6a7466df930715dfda835e00f3c2c8da6a7145ce Mon Sep 17 00:00:00 2001 From: iequidoo Date: Sun, 28 Sep 2025 13:41:35 -0300 Subject: [PATCH] fix: Only omit group changes messages if SELF is really added (#7220) If a self-addition message is received, but we're already in the group, there must be no hidden member changes. --- src/receive_imf.rs | 4 +++- src/tests/verified_chats.rs | 7 ++++++- test-data/golden/verified_chats_editor_reordering | 11 +++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 test-data/golden/verified_chats_editor_reordering diff --git a/src/receive_imf.rs b/src/receive_imf.rs index 60975d564..bfe4e21a1 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -3078,7 +3078,9 @@ async fn apply_group_changes( if let Some(removed_id) = removed_id { removed_ids.remove(&removed_id); } - let group_changes_msgs = if self_added { + let group_changes_msgs = if !chat_contacts.contains(&ContactId::SELF) + && new_chat_contacts.contains(&ContactId::SELF) + { Vec::new() } else { group_changes_msgs(context, &added_ids, &removed_ids, chat.id).await? diff --git a/src/tests/verified_chats.rs b/src/tests/verified_chats.rs index 390cecda3..f1e6bba48 100644 --- a/src/tests/verified_chats.rs +++ b/src/tests/verified_chats.rs @@ -783,7 +783,12 @@ async fn test_verified_chat_editor_reordering() -> Result<()> { tcm.section("Charlie receives member added message"); charlie.recv_msg(&sent_member_added_msg).await; - + charlie + .golden_test_chat( + charlie_received_xdc.chat_id, + "verified_chats_editor_reordering", + ) + .await; Ok(()) } diff --git a/test-data/golden/verified_chats_editor_reordering b/test-data/golden/verified_chats_editor_reordering new file mode 100644 index 000000000..21b949fb2 --- /dev/null +++ b/test-data/golden/verified_chats_editor_reordering @@ -0,0 +1,11 @@ +Group#Chat#11: Group [3 member(s)] 🛡️ +-------------------------------------------------------------------------------- +Msg#11: info (Contact#Contact#Info): alice@example.org invited you to join this group. + +Waiting for the device of alice@example.org to reply… [NOTICED][INFO] +Msg#13: info (Contact#Contact#Info): alice@example.org replied, waiting for being added to the group… [NOTICED][INFO] +Msg#16🔒: (Contact#Contact#11): [FRESH] +Msg#18: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO 🛡️] +Msg#19: info (Contact#Contact#Info): Member bob@example.net added. [NOTICED][INFO] +Msg#20🔒: (Contact#Contact#10): Member Me added by alice@example.org. [FRESH][INFO] +--------------------------------------------------------------------------------