From 159068c772cfe625fb5ae7da334b9354b2bce977 Mon Sep 17 00:00:00 2001 From: bjoern Date: Wed, 2 Apr 2025 19:45:52 +0200 Subject: [PATCH] feat: remove email address from 'add second device' qr code (#6760) for tuning down email address everywhere, that bit is missing in core. it was never useful, as it was never shown on the receivers side. and for the sender side, the context the qr code is opened is clear --------- Co-authored-by: Hocuri --- src/stock_str.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/stock_str.rs b/src/stock_str.rs index 832c4bdff..6508fecc8 100644 --- a/src/stock_str.rs +++ b/src/stock_str.rs @@ -1340,20 +1340,19 @@ pub(crate) async fn new_group_send_first_message(context: &Context) -> String { /// Text to put in the [`Qr::Backup2`] rendered SVG image. /// -/// The default is "Scan to set up second device for ". The -/// account name and address are looked up from the context. +/// The default is "Scan to set up second device for NAME". +/// The account name (or address as fallback) are looked up from the context. /// /// [`Qr::Backup2`]: crate::qr::Qr::Backup2 pub(crate) async fn backup_transfer_qr(context: &Context) -> Result { - let contact = Contact::get_by_id(context, ContactId::SELF).await?; - let addr = contact.get_addr(); - let full_name = match context.get_config(Config::Displayname).await? { - Some(name) if name != addr => format!("{name} ({addr})"), - _ => addr.to_string(), + let name = if let Some(name) = context.get_config(Config::Displayname).await? { + name + } else { + context.get_primary_self_addr().await? }; Ok(translated(context, StockMessage::BackupTransferQr) .await - .replace1(&full_name)) + .replace1(&name)) } pub(crate) async fn backup_transfer_msg_body(context: &Context) -> String {