test: Add test_leave_broadcast, fix bugs I found along the way

This commit is contained in:
Hocuri
2025-09-11 11:40:44 +02:00
parent ac98289728
commit 632dd28e5b
4 changed files with 61 additions and 16 deletions

View File

@@ -3508,11 +3508,13 @@ async fn apply_out_broadcast_changes(
.await?;
if let Some(removed_fpr) = mime_parser.get_header(HeaderDef::ChatGroupMemberRemovedFpr) {
send_event_chat_modified = true;
let removed_id = lookup_key_contact_by_fingerprint(context, removed_fpr).await?;
if removed_id == Some(from_id) {
// The sender of the message left the broadcast channel
// Silently remove them without notifying the user
chat::remove_from_chat_contacts_table_without_trace(context, chat.id, from_id).await?;
info!(context, "Broadcast leave message (TRASH)");
better_msg = Some("".to_string());
} else if from_id == ContactId::SELF {
if let Some(removed_id) = removed_id {