Skip to content

Commit cd6d181

Browse files
authored
enable BccSelf by default (#3612)
* enable `BccSelf` by default enabling `BccSelf` improves user experience as it is easier to set up another device and ppl will also see "all" messages in other user agents directly. for uncounted user problems, after diving into the issue, the resulting device was "turn on BccSelf". disabled `BccSelf` was probably the the number one single reason of user problems. main drawback of the change are potentially double notifications when using a shared account and having another mail app on the same device. however, we meanwhile do not recommend shared accounts at all, the issue is also fixable by the other mail apps (as done by K-9) and could be even regarded as a feature (you can decide which app to use for ansering). but at the end the drawback is probably much smaller than the issues reported above. * adapt tests to `BccSelf` enabled * update CHANGELOG
1 parent c92c6a2 commit cd6d181

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- truncate incoming messages by lines instead of just length #3480
1010
- emit separate `DC_EVENT_MSGS_CHANGED` for each expired message,
1111
and `DC_EVENT_WEBXDC_INSTANCE_DELETED` when a message contains a webxdc #3605
12+
- enable `bcc_self` by default #3612
1213

1314
### Fixes
1415

src/chat.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4554,26 +4554,24 @@ mod tests {
45544554
}
45554555

45564556
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
4557-
async fn test_set_protection() {
4557+
async fn test_set_protection() -> Result<()> {
45584558
let t = TestContext::new_alice().await;
4559-
let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo")
4560-
.await
4561-
.unwrap();
4562-
let chat = Chat::load_from_db(&t, chat_id).await.unwrap();
4559+
t.set_config_bool(Config::BccSelf, false).await?;
4560+
let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?;
4561+
let chat = Chat::load_from_db(&t, chat_id).await?;
45634562
assert!(!chat.is_protected());
45644563
assert!(chat.is_unpromoted());
45654564

45664565
// enable protection on unpromoted chat, the info-message is added via add_info_msg()
45674566
chat_id
45684567
.set_protection(&t, ProtectionStatus::Protected)
4569-
.await
4570-
.unwrap();
4568+
.await?;
45714569

4572-
let chat = Chat::load_from_db(&t, chat_id).await.unwrap();
4570+
let chat = Chat::load_from_db(&t, chat_id).await?;
45734571
assert!(chat.is_protected());
45744572
assert!(chat.is_unpromoted());
45754573

4576-
let msgs = get_chat_msgs(&t, chat_id, 0).await.unwrap();
4574+
let msgs = get_chat_msgs(&t, chat_id, 0).await?;
45774575
assert_eq!(msgs.len(), 1);
45784576

45794577
let msg = t.get_last_msg_in(chat_id).await;
@@ -4584,10 +4582,9 @@ mod tests {
45844582
// disable protection again, still unpromoted
45854583
chat_id
45864584
.set_protection(&t, ProtectionStatus::Unprotected)
4587-
.await
4588-
.unwrap();
4585+
.await?;
45894586

4590-
let chat = Chat::load_from_db(&t, chat_id).await.unwrap();
4587+
let chat = Chat::load_from_db(&t, chat_id).await?;
45914588
assert!(!chat.is_protected());
45924589
assert!(chat.is_unpromoted());
45934590

@@ -4597,28 +4594,29 @@ mod tests {
45974594
assert_eq!(msg.get_state(), MessageState::InNoticed);
45984595

45994596
// send a message, this switches to promoted state
4600-
send_text_msg(&t, chat_id, "hi!".to_string()).await.unwrap();
4597+
send_text_msg(&t, chat_id, "hi!".to_string()).await?;
46014598

4602-
let chat = Chat::load_from_db(&t, chat_id).await.unwrap();
4599+
let chat = Chat::load_from_db(&t, chat_id).await?;
46034600
assert!(!chat.is_protected());
46044601
assert!(!chat.is_unpromoted());
46054602

4606-
let msgs = get_chat_msgs(&t, chat_id, 0).await.unwrap();
4603+
let msgs = get_chat_msgs(&t, chat_id, 0).await?;
46074604
assert_eq!(msgs.len(), 3);
46084605

46094606
// enable protection on promoted chat, the info-message is sent via send_msg() this time
46104607
chat_id
46114608
.set_protection(&t, ProtectionStatus::Protected)
4612-
.await
4613-
.unwrap();
4614-
let chat = Chat::load_from_db(&t, chat_id).await.unwrap();
4609+
.await?;
4610+
let chat = Chat::load_from_db(&t, chat_id).await?;
46154611
assert!(chat.is_protected());
46164612
assert!(!chat.is_unpromoted());
46174613

46184614
let msg = t.get_last_msg_in(chat_id).await;
46194615
assert!(msg.is_info());
46204616
assert_eq!(msg.get_info_type(), SystemMessage::ChatProtectionEnabled);
46214617
assert_eq!(msg.get_state(), MessageState::OutDelivered); // as bcc-self is disabled and there is nobody else in the chat
4618+
4619+
Ok(())
46224620
}
46234621

46244622
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub enum Config {
5555
Selfstatus,
5656
Selfavatar,
5757

58-
#[strum(props(default = "0"))]
58+
#[strum(props(default = "1"))]
5959
BccSelf,
6060

6161
#[strum(props(default = "1"))]

src/webxdc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,7 @@ mod tests {
948948
async fn test_resend_webxdc_instance_and_info() -> Result<()> {
949949
// Alice uses webxdc in a group
950950
let alice = TestContext::new_alice().await;
951+
alice.set_config_bool(Config::BccSelf, false).await?;
951952
let alice_grp = create_group_chat(&alice, ProtectionStatus::Unprotected, "grp").await?;
952953
let alice_instance = send_webxdc_instance(&alice, alice_grp).await?;
953954
assert_eq!(alice_grp.get_msg_cnt(&alice).await?, 1);

0 commit comments

Comments
 (0)