From ce83952b4f50106de0b31116a35634938b2da309 Mon Sep 17 00:00:00 2001 From: Hocuri Date: Wed, 16 Jul 2025 15:02:49 +0200 Subject: [PATCH] feat: Allow leaving a 'Contact Request' group/channel --- src/chat.rs | 6 +++++- src/chat/chat_tests.rs | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index acb63da39..633bb6357 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -2907,7 +2907,11 @@ async fn prepare_send_msg( 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 + // 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 diff --git a/src/chat/chat_tests.rs b/src/chat/chat_tests.rs index b6c263ba4..937a60b27 100644 --- a/src/chat/chat_tests.rs +++ b/src/chat/chat_tests.rs @@ -2975,7 +2975,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;