Skip to content

Commit 5711f2f

Browse files
authored
feat: More context for the "Cannot establish guaranteed..." info message (#6022)
The "Cannot establish guaranteed end-to-end encryption with ..." info message can have lots of causes, and it happened twice to us now that it took us some time to figure out which one it is. So, include some more detail in the info message by simply adding the non-translated error message in parantheses. If we want to put in some more effort for nicer error messages, we could: - Introduce one new translated string "Cannot establish guaranteed end-to-end encryption with …. Cause: %2$s" or similar (and remove the old stock string) - And/Or: Introduce new translated strings for all the possible errors - And/Or: Maybe reword it in order to account better for the case that the chat already is marked as g-e2ee, or use a different wording (because if the chat is marked as g-e2ee then it might be nice to notify the user that something may have gone wrong, but it's still working, just that maybe the other side doesn't have us verified now) ![Screenshot_20241003-222245](https://github.com/user-attachments/assets/c064c82e-01ac-4bac-ab11-3c9ac9db5298)
1 parent 46922d4 commit 5711f2f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/securejoin.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,10 @@ async fn could_not_establish_secure_connection(
696696
details: &str,
697697
) -> Result<()> {
698698
let contact = Contact::get_by_id(context, contact_id).await?;
699-
let msg = stock_str::contact_not_verified(context, &contact).await;
699+
let mut msg = stock_str::contact_not_verified(context, &contact).await;
700+
msg += " (";
701+
msg += details;
702+
msg += ")";
700703
chat::add_info_msg(context, chat_id, &msg, time()).await?;
701704
warn!(
702705
context,

src/securejoin/bob.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul
4747
BobState::start_protocol(context, invite.clone(), chat_id).await?;
4848
for state in aborted_states {
4949
error!(context, "Aborting previously unfinished QR Join process.");
50-
state.notify_aborted(context, "new QR scanned").await?;
50+
state.notify_aborted(context, "New QR code scanned").await?;
5151
state.emit_progress(context, JoinerProgress::Error);
5252
}
5353
if matches!(stage, BobHandshakeStage::RequestWithAuthSent) {
@@ -194,7 +194,10 @@ impl BobState {
194194
/// This creates an info message in the chat being joined.
195195
async fn notify_aborted(&self, context: &Context, why: &str) -> Result<()> {
196196
let contact = Contact::get_by_id(context, self.invite().contact_id()).await?;
197-
let msg = stock_str::contact_not_verified(context, &contact).await;
197+
let mut msg = stock_str::contact_not_verified(context, &contact).await;
198+
msg += " (";
199+
msg += why;
200+
msg += ")";
198201
let chat_id = self.joining_chat_id(context).await?;
199202
chat::add_info_msg(context, chat_id, &msg, time()).await?;
200203
warn!(

0 commit comments

Comments
 (0)