test: test_remove_member_bcc: Test unencrypted group as it was initially

This commit is contained in:
iequidoo
2025-11-29 15:53:37 -03:00
committed by iequidoo
parent dc5f939ac6
commit ef61c0c408
2 changed files with 27 additions and 14 deletions

View File

@@ -3730,10 +3730,16 @@ pub(crate) async fn add_contact_to_chat_ex(
chat.typ != Chattype::OutBroadcast || contact_id != ContactId::SELF,
"Cannot add SELF to broadcast channel."
);
ensure!(
chat.is_encrypted(context).await? == contact.is_key_contact(),
"Only key-contacts can be added to encrypted chats"
);
match chat.is_encrypted(context).await? {
true => ensure!(
contact.is_key_contact(),
"Only key-contacts can be added to encrypted chats"
),
false => ensure!(
!contact.is_key_contact(),
"Only address-contacts can be added to unencrypted chats"
),
}
if !chat.is_self_in_chat(context).await? {
context.emit_event(EventType::ErrorSelfNotInGroup(