feat: no unencrypted chat when securejoin times out (#6722)

this PR leaves one-to-one chats that were created by a QR code scan
unwritable until e2ee is established.

the logic of the timeout is reused to show a message with additional
information:

<img width=250
src=https://github.com/user-attachments/assets/b9928e7b-8128-4d7a-934d-37d51c8275ce>
<img width=250
src=https://github.com/user-attachments/assets/4a3a28e9-4491-47f9-8962-86aa2302dd21>
<img width=250
src=https://github.com/user-attachments/assets/5130a87c-ba1c-496f-81e1-899dc8aabe4e>

if the secure-join finishes faster than the 15 seconds, the middle
message is not shown.

closes #6706
This commit is contained in:
bjoern
2025-04-01 16:53:37 +02:00
committed by GitHub
parent 70563867a6
commit ee079ce021
4 changed files with 45 additions and 34 deletions

View File

@@ -438,9 +438,9 @@ pub enum StockMessage {
SecurejoinWait = 190,
#[strum(props(
fallback = "Could not yet establish guaranteed end-to-end encryption, but you may already send a message."
fallback = "This takes longer than expected, maybe devices are offline…\n\nHowever, the process continues in background, you can do something else 🕺"
))]
SecurejoinWaitTimeout = 191,
SecurejoinTakesLonger = 192,
}
impl StockMessage {
@@ -833,8 +833,8 @@ pub(crate) async fn securejoin_wait(context: &Context) -> String {
}
/// Stock string: `Could not yet establish guaranteed end-to-end encryption, but you may already send a message.`.
pub(crate) async fn securejoin_wait_timeout(context: &Context) -> String {
translated(context, StockMessage::SecurejoinWaitTimeout).await
pub(crate) async fn securejoin_takes_longer(context: &Context) -> String {
translated(context, StockMessage::SecurejoinTakesLonger).await
}
/// Stock string: `Scan to chat with %1$s`.