Skip to content

Commit

Permalink
fix: show padlock when the message is not sent over the network
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Feb 17, 2025
1 parent 20d6f0f commit 8eff4f4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3024,6 +3024,8 @@ pub(crate) async fn create_send_msg_jobs(context: &Context, msg: &mut Message) -
context,
"Message {} has no recipient, skipping smtp-send.", msg.id
);
msg.param.set_int(Param::GuaranteeE2ee, 1);
msg.update_param(context).await?;
msg.id.set_delivered(context).await?;
msg.state = MessageState::OutDelivered;
return Ok(Vec::new());
Expand Down
15 changes: 15 additions & 0 deletions src/chat/chat_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,21 @@ async fn test_self_talk() -> Result<()> {
Ok(())
}

/// Tests that when BCC-self is disabled
/// and no messages are actually sent
/// in a self-chat, they have a padlock.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_self_talk_no_bcc_padlock() -> Result<()> {
let t = &TestContext::new_alice().await;
t.set_config_bool(Config::BccSelf, false).await?;
let chat = &t.get_self_chat().await;

let msg_id = send_text_msg(t, chat.id, "Foobar".to_string()).await?;
let msg = Message::load_from_db(t, msg_id).await?;
assert!(msg.get_showpadlock());
Ok(())
}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_add_device_msg_unlabelled() {
let t = TestContext::new().await;
Expand Down

0 comments on commit 8eff4f4

Please sign in to comment.