Compare commits

...

3 Commits

Author SHA1 Message Date
Hocuri
8ed2a220e7 fix comment 2025-08-05 16:53:44 +02:00
Hocuri
adeb2e0a61 test: Don't accept contact request group before leaving 2025-08-05 16:52:36 +02:00
Hocuri
ce83952b4f feat: Allow leaving a 'Contact Request' group/channel 2025-08-05 16:52:35 +02:00
2 changed files with 6 additions and 5 deletions

View File

@@ -2905,9 +2905,12 @@ async fn prepare_send_msg(
let skip_fn = |reason: &CantSendReason| match reason {
CantSendReason::ContactRequest => {
// Allow securejoin messages, they are supposed to repair the verification.
// If the chat is a contact request, let the user accept it later.
msg.param.get_cmd() == SystemMessage::SecurejoinMessage
// If the chat is a contact request, allow securejoin messages and let the user accept it later.
// And allow leaving a contact request chat.
matches!(
msg.param.get_cmd(),
SystemMessage::SecurejoinMessage | SystemMessage::MemberRemovedFromGroup
)
}
// Allow to send "Member removed" messages so we can leave the group/broadcast.
// Necessary checks should be made anyway before removing contact

View File

@@ -739,7 +739,6 @@ async fn test_leave_group() -> Result<()> {
tcm.section("Bob leaves the group.");
let bob_chat_id = bob_msg.chat_id;
bob_chat_id.accept(&bob).await?;
remove_contact_from_chat(&bob, bob_chat_id, ContactId::SELF).await?;
let leave_msg = bob.pop_sent_msg().await;
@@ -2975,7 +2974,6 @@ async fn test_leave_broadcast() -> Result<()> {
tcm.section("Bob leaves the broadcast channel.");
let bob_chat_id = bob_msg.chat_id;
bob_chat_id.accept(bob).await?;
remove_contact_from_chat(bob, bob_chat_id, ContactId::SELF).await?;
let leave_msg = bob.pop_sent_msg().await;