From 40faf829d3ce3a4dcca1e82be9c8f1ef110a5192 Mon Sep 17 00:00:00 2001 From: link2xt Date: Thu, 13 Aug 2026 00:23:30 +0000 Subject: [PATCH] feat: stop creating info messages for old broadcast lists Creating QR code or sending a message will still fail with a shorter error, but no info message will be created anymore. Most users should have migrated the channels by recreating them by now. This change is needed for moving loading of the shared secret to earlier stages of message preparation, otherwise mimefactory will have to create these info messages when loading the message into memory. --- src/constants.rs | 12 ------------ src/mimefactory.rs | 19 +++++++------------ src/securejoin.rs | 19 ++++++------------- 3 files changed, 13 insertions(+), 37 deletions(-) diff --git a/src/constants.rs b/src/constants.rs index e58b7d533..9a0aefd4d 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -199,18 +199,6 @@ pub(crate) const EDITED_PREFIX: &str = "✏️"; /// Period between `sql::housekeeping()` runs. pub(crate) const HOUSEKEEPING_PERIOD: i64 = 24 * 60 * 60; -pub(crate) const BROADCAST_INCOMPATIBILITY_MSG: &str = r#"The up to now "experimental channels feature" is about to become an officially supported one. By that, privacy will be improved, it will become faster, and less traffic will be consumed. - -As we do not guarantee feature-stability for such experiments, this means, that you will need to create the channel again. - -Here is what to do: - • Create a new channel - • Tap on the channel name - • Tap on "QR Invite Code" - • Have all recipients scan the QR code, or send them the link - -If you have any questions, please send an email to delta@merlinux.eu or ask at https://support.delta.chat/."#; - /// Number of recent messages that should be resent to a new broadcast member. /// Additionally, up to this amount of pinned messages will be resent. pub(crate) const N_MSGS_TO_NEW_BROADCAST_MEMBER: usize = 10; diff --git a/src/mimefactory.rs b/src/mimefactory.rs index 3d5dfe70a..9eb311b1f 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -17,7 +17,7 @@ use crate::aheader::{Aheader, EncryptPreference}; use crate::blob::BlobObject; use crate::chat::{self, Chat, PARAM_BROADCAST_SECRET, load_broadcast_secret}; use crate::config::Config; -use crate::constants::{BROADCAST_INCOMPATIBILITY_MSG, Chattype, DC_FROM_HANDSHAKE}; +use crate::constants::{Chattype, DC_FROM_HANDSHAKE}; use crate::contact::{Contact, ContactId, Origin}; use crate::context::Context; use crate::download::PostMsgMetadata; @@ -1417,17 +1417,12 @@ impl MimeFactory { let shared_secret: Option = match &self.loaded { Loaded::Message { chat, msg } if should_encrypt_with_broadcast_secret(msg, chat) => { - let secret = load_broadcast_secret(context, chat.id).await?; - if secret.is_none() { - // If there is no shared secret yet - // because this is an old broadcast channel, - // created before we had symmetric encryption, - // we show an error message. - let text = BROADCAST_INCOMPATIBILITY_MSG; - chat::add_info_msg(context, chat.id, text).await?; - bail!(text); - } - secret + // Sending a message may fail for old broadcast channels + // created before shared secrets were introduced. + let secret = load_broadcast_secret(context, chat.id) + .await? + .context("Broadcast has no secret")?; + Some(secret) } _ => None, }; diff --git a/src/securejoin.rs b/src/securejoin.rs index 102cd9893..8a2eec24d 100644 --- a/src/securejoin.rs +++ b/src/securejoin.rs @@ -4,13 +4,9 @@ use anyhow::{Context as _, Error, Result, bail, ensure}; use deltachat_contact_tools::ContactAddress; use percent_encoding::{AsciiSet, utf8_percent_encode}; -use crate::chat::{ - self, Chat, ChatId, ChatIdBlocked, add_info_msg, get_chat_id_by_grpid, load_broadcast_secret, -}; +use crate::chat::{self, Chat, ChatId, ChatIdBlocked, get_chat_id_by_grpid, load_broadcast_secret}; use crate::config::Config; -use crate::constants::{ - BROADCAST_INCOMPATIBILITY_MSG, Blocked, Chattype, NON_ALPHANUMERIC_WITHOUT_DOT, -}; +use crate::constants::{Blocked, Chattype, NON_ALPHANUMERIC_WITHOUT_DOT}; use crate::contact::mark_contact_id_as_verified; use crate::contact::{Contact, ContactId, Origin}; use crate::context::Context; @@ -111,14 +107,11 @@ pub async fn get_securejoin_qr(context: &Context, chat: Option) -> Resul // If the user created the broadcast before updating Delta Chat, // then the secret will be missing, and the user needs to recreate the broadcast: if load_broadcast_secret(context, chat.id).await?.is_none() { - error!( - context, - "Not creating securejoin QR for old broadcast {}, see chat for more info.", - chat.id, + let err = format!( + "Can't create QR code for old broadcast list {id} without a shared secret" ); - let text = BROADCAST_INCOMPATIBILITY_MSG; - add_info_msg(context, chat.id, text).await?; - bail!(text.to_string()); + error!(context, "get_securejoin_qr: {err}."); + bail!(err); } } Some(chat)