diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a3ff8c6b..66deb3c6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - truncate incoming messages by lines instead of just length #3480 - emit separate `DC_EVENT_MSGS_CHANGED` for each expired message, and `DC_EVENT_WEBXDC_INSTANCE_DELETED` when a message contains a webxdc #3605 +- enable `bcc_self` by default #3612 ### Fixes diff --git a/src/chat.rs b/src/chat.rs index f2927a6b6..cbc5f0636 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -4554,26 +4554,24 @@ mod tests { } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] - async fn test_set_protection() { + async fn test_set_protection() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo") - .await - .unwrap(); - let chat = Chat::load_from_db(&t, chat_id).await.unwrap(); + t.set_config_bool(Config::BccSelf, false).await?; + let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat = Chat::load_from_db(&t, chat_id).await?; assert!(!chat.is_protected()); assert!(chat.is_unpromoted()); // enable protection on unpromoted chat, the info-message is added via add_info_msg() chat_id .set_protection(&t, ProtectionStatus::Protected) - .await - .unwrap(); + .await?; - let chat = Chat::load_from_db(&t, chat_id).await.unwrap(); + let chat = Chat::load_from_db(&t, chat_id).await?; assert!(chat.is_protected()); assert!(chat.is_unpromoted()); - let msgs = get_chat_msgs(&t, chat_id, 0).await.unwrap(); + let msgs = get_chat_msgs(&t, chat_id, 0).await?; assert_eq!(msgs.len(), 1); let msg = t.get_last_msg_in(chat_id).await; @@ -4584,10 +4582,9 @@ mod tests { // disable protection again, still unpromoted chat_id .set_protection(&t, ProtectionStatus::Unprotected) - .await - .unwrap(); + .await?; - let chat = Chat::load_from_db(&t, chat_id).await.unwrap(); + let chat = Chat::load_from_db(&t, chat_id).await?; assert!(!chat.is_protected()); assert!(chat.is_unpromoted()); @@ -4597,21 +4594,20 @@ mod tests { assert_eq!(msg.get_state(), MessageState::InNoticed); // send a message, this switches to promoted state - send_text_msg(&t, chat_id, "hi!".to_string()).await.unwrap(); + send_text_msg(&t, chat_id, "hi!".to_string()).await?; - let chat = Chat::load_from_db(&t, chat_id).await.unwrap(); + let chat = Chat::load_from_db(&t, chat_id).await?; assert!(!chat.is_protected()); assert!(!chat.is_unpromoted()); - let msgs = get_chat_msgs(&t, chat_id, 0).await.unwrap(); + let msgs = get_chat_msgs(&t, chat_id, 0).await?; assert_eq!(msgs.len(), 3); // enable protection on promoted chat, the info-message is sent via send_msg() this time chat_id .set_protection(&t, ProtectionStatus::Protected) - .await - .unwrap(); - let chat = Chat::load_from_db(&t, chat_id).await.unwrap(); + .await?; + let chat = Chat::load_from_db(&t, chat_id).await?; assert!(chat.is_protected()); assert!(!chat.is_unpromoted()); @@ -4619,6 +4615,8 @@ mod tests { assert!(msg.is_info()); assert_eq!(msg.get_info_type(), SystemMessage::ChatProtectionEnabled); assert_eq!(msg.get_state(), MessageState::OutDelivered); // as bcc-self is disabled and there is nobody else in the chat + + Ok(()) } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] diff --git a/src/config.rs b/src/config.rs index d3fe61d25..3574a5aef 100644 --- a/src/config.rs +++ b/src/config.rs @@ -55,7 +55,7 @@ pub enum Config { Selfstatus, Selfavatar, - #[strum(props(default = "0"))] + #[strum(props(default = "1"))] BccSelf, #[strum(props(default = "1"))] diff --git a/src/webxdc.rs b/src/webxdc.rs index 3d21d0f4d..087fc607d 100644 --- a/src/webxdc.rs +++ b/src/webxdc.rs @@ -948,6 +948,7 @@ mod tests { async fn test_resend_webxdc_instance_and_info() -> Result<()> { // Alice uses webxdc in a group let alice = TestContext::new_alice().await; + alice.set_config_bool(Config::BccSelf, false).await?; let alice_grp = create_group_chat(&alice, ProtectionStatus::Unprotected, "grp").await?; let alice_instance = send_webxdc_instance(&alice, alice_grp).await?; assert_eq!(alice_grp.get_msg_cnt(&alice).await?, 1);