mirror of
https://github.com/chatmail/core.git
synced 2026-05-16 21:36:30 +03:00
Replace "End-to-end-encryption unavailable unexpectedly" with translatable string
This commit is contained in:
23
src/chat.rs
23
src/chat.rs
@@ -2895,11 +2895,26 @@ pub(crate) async fn create_send_msg_jobs(context: &Context, msg: &mut Message) -
|
|||||||
}
|
}
|
||||||
|
|
||||||
if needs_encryption && !rendered_msg.is_encrypted {
|
if needs_encryption && !rendered_msg.is_encrypted {
|
||||||
/* unrecoverable */
|
let addr = context.get_config(Config::ConfiguredAddr).await?;
|
||||||
message::set_msg_failed(
|
let text = stock_str::unencrypted_email(
|
||||||
context,
|
context,
|
||||||
msg,
|
addr.unwrap_or_default()
|
||||||
"End-to-end-encryption unavailable unexpectedly.",
|
.split('@')
|
||||||
|
.nth(1)
|
||||||
|
.unwrap_or_default(),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
message::set_msg_failed(context, msg, &text).await?;
|
||||||
|
add_info_msg_with_cmd(
|
||||||
|
context,
|
||||||
|
msg.chat_id,
|
||||||
|
&text,
|
||||||
|
SystemMessage::InvalidUnencryptedMail,
|
||||||
|
Some(msg.timestamp_sort),
|
||||||
|
msg.timestamp_sort,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
bail!(
|
bail!(
|
||||||
|
|||||||
10
src/e2ee.rs
10
src/e2ee.rs
@@ -113,6 +113,7 @@ mod tests {
|
|||||||
use crate::chat::send_text_msg;
|
use crate::chat::send_text_msg;
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::message::Message;
|
use crate::message::Message;
|
||||||
|
use crate::mimeparser::SystemMessage;
|
||||||
use crate::receive_imf::receive_imf;
|
use crate::receive_imf::receive_imf;
|
||||||
use crate::test_utils::{TestContext, TestContextManager};
|
use crate::test_utils::{TestContext, TestContextManager};
|
||||||
|
|
||||||
@@ -165,6 +166,15 @@ Sent with my Delta Chat Messenger: https://delta.chat";
|
|||||||
|
|
||||||
let mut msg = Message::new_text("Hello!".to_string());
|
let mut msg = Message::new_text("Hello!".to_string());
|
||||||
assert!(chat::send_msg(alice, chat.id, &mut msg).await.is_err());
|
assert!(chat::send_msg(alice, chat.id, &mut msg).await.is_err());
|
||||||
|
assert_eq!(
|
||||||
|
msg.error().unwrap(),
|
||||||
|
"\u{26a0}\u{fe0f} Your email provider example.org requires end-to-end encryption which is not setup yet."
|
||||||
|
);
|
||||||
|
let info_msg = alice.get_last_msg().await;
|
||||||
|
assert_eq!(
|
||||||
|
info_msg.get_info_type(),
|
||||||
|
SystemMessage::InvalidUnencryptedMail
|
||||||
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user