Skip to content

Commit bf4f5c9

Browse files
committed
feat: Allow leaving a 'Contact Request' group/channel
1 parent f5e8c80 commit bf4f5c9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/chat.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2908,7 +2908,11 @@ async fn prepare_send_msg(
29082908
CantSendReason::ProtectionBroken | CantSendReason::ContactRequest => {
29092909
// Allow securejoin messages, they are supposed to repair the verification.
29102910
// If the chat is a contact request, let the user accept it later.
2911-
msg.param.get_cmd() == SystemMessage::SecurejoinMessage
2911+
// And allow leaving a contact request chat.
2912+
matches!(
2913+
msg.param.get_cmd(),
2914+
SystemMessage::SecurejoinMessage | SystemMessage::MemberRemovedFromGroup
2915+
)
29122916
}
29132917
// Allow to send "Member removed" messages so we can leave the group/broadcast.
29142918
// Necessary checks should be made anyway before removing contact

src/chat/chat_tests.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2963,7 +2963,6 @@ async fn test_leave_broadcast() -> Result<()> {
29632963

29642964
tcm.section("Bob leaves the broadcast channel.");
29652965
let bob_chat_id = bob_msg.chat_id;
2966-
bob_chat_id.accept(bob).await?;
29672966
remove_contact_from_chat(bob, bob_chat_id, ContactId::SELF).await?;
29682967

29692968
let leave_msg = bob.pop_sent_msg().await;

0 commit comments

Comments
 (0)