Skip to content

Commit 8eff4f4

Browse files
committed
fix: show padlock when the message is not sent over the network
1 parent 20d6f0f commit 8eff4f4

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/chat.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3024,6 +3024,8 @@ pub(crate) async fn create_send_msg_jobs(context: &Context, msg: &mut Message) -
30243024
context,
30253025
"Message {} has no recipient, skipping smtp-send.", msg.id
30263026
);
3027+
msg.param.set_int(Param::GuaranteeE2ee, 1);
3028+
msg.update_param(context).await?;
30273029
msg.id.set_delivered(context).await?;
30283030
msg.state = MessageState::OutDelivered;
30293031
return Ok(Vec::new());

src/chat/chat_tests.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,21 @@ async fn test_self_talk() -> Result<()> {
774774
Ok(())
775775
}
776776

777+
/// Tests that when BCC-self is disabled
778+
/// and no messages are actually sent
779+
/// in a self-chat, they have a padlock.
780+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
781+
async fn test_self_talk_no_bcc_padlock() -> Result<()> {
782+
let t = &TestContext::new_alice().await;
783+
t.set_config_bool(Config::BccSelf, false).await?;
784+
let chat = &t.get_self_chat().await;
785+
786+
let msg_id = send_text_msg(t, chat.id, "Foobar".to_string()).await?;
787+
let msg = Message::load_from_db(t, msg_id).await?;
788+
assert!(msg.get_showpadlock());
789+
Ok(())
790+
}
791+
777792
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
778793
async fn test_add_device_msg_unlabelled() {
779794
let t = TestContext::new().await;

0 commit comments

Comments
 (0)