mirror of
https://github.com/chatmail/core.git
synced 2026-04-27 18:36:30 +03:00
fix: Actually send broadcast message to recipients, ALL TESTS PASS NOW - fix test_broadcasts_name_and_avatar().
This commit is contained in:
@@ -2800,7 +2800,6 @@ async fn test_broadcasts_name_and_avatar() -> Result<()> {
|
||||
let alice = &tcm.alice().await;
|
||||
alice.set_config(Config::Displayname, Some("Alice")).await?;
|
||||
let bob = &tcm.bob().await;
|
||||
let alice_bob_contact_id = alice.add_or_lookup_contact_id(bob).await;
|
||||
|
||||
tcm.section("Create a broadcast channel");
|
||||
let alice_chat_id = create_broadcast(alice, "My Channel".to_string()).await?;
|
||||
@@ -2815,7 +2814,8 @@ async fn test_broadcasts_name_and_avatar() -> Result<()> {
|
||||
assert_eq!(sent.recipients, "alice@example.org");
|
||||
|
||||
tcm.section("Add a contact to the chat and send a message");
|
||||
add_contact_to_chat(alice, alice_chat_id, alice_bob_contact_id).await?;
|
||||
let qr = get_securejoin_qr(alice, Some(alice_chat_id)).await.unwrap();
|
||||
tcm.exec_securejoin_qr(bob, alice, &qr).await;
|
||||
let sent = alice.send_text(alice_chat_id, "Hi somebody").await;
|
||||
|
||||
assert_eq!(sent.recipients, "bob@example.net alice@example.org");
|
||||
|
||||
@@ -231,9 +231,6 @@ impl MimeFactory {
|
||||
|
||||
// Do not encrypt messages to mailing lists.
|
||||
encryption_keys = None;
|
||||
} else if chat.is_out_broadcast() {
|
||||
// Encrypt, but only symmetrically, not with the public keys.
|
||||
encryption_keys = Some(Vec::new());
|
||||
} else {
|
||||
let email_to_remove = if msg.param.get_cmd() == SystemMessage::MemberRemovedFromGroup {
|
||||
msg.param.get(Param::Arg)
|
||||
@@ -332,7 +329,7 @@ impl MimeFactory {
|
||||
|
||||
if let Some(public_key) = public_key_opt {
|
||||
keys.push((addr.clone(), public_key))
|
||||
} else if id != ContactId::SELF {
|
||||
} else if id != ContactId::SELF && !chat.is_any_broadcast() {
|
||||
missing_key_addresses.insert(addr.clone());
|
||||
if is_encrypted {
|
||||
warn!(context, "Missing key for {addr}");
|
||||
@@ -353,7 +350,7 @@ impl MimeFactory {
|
||||
|
||||
if let Some(public_key) = public_key_opt {
|
||||
keys.push((addr.clone(), public_key))
|
||||
} else if id != ContactId::SELF {
|
||||
} else if id != ContactId::SELF && !chat.is_any_broadcast() {
|
||||
missing_key_addresses.insert(addr.clone());
|
||||
if is_encrypted {
|
||||
warn!(context, "Missing key for {addr}");
|
||||
@@ -420,6 +417,9 @@ impl MimeFactory {
|
||||
|
||||
encryption_keys = if !is_encrypted {
|
||||
None
|
||||
} else if chat.is_out_broadcast() {
|
||||
// Encrypt, but only symmetrically, not with the public keys.
|
||||
Some(Vec::new())
|
||||
} else {
|
||||
if keys.is_empty() && !recipients.is_empty() {
|
||||
bail!(
|
||||
|
||||
Reference in New Issue
Block a user