feat: Add strings 'You left the channel.' and 'Scan to join Channel' (#7266)

Close https://github.com/chatmail/core/issues/7233

Part of https://github.com/chatmail/core/issues/6884
This commit is contained in:
Hocuri
2025-10-02 16:57:24 +02:00
committed by GitHub
parent d509b0cf5c
commit 9ec0332483
6 changed files with 46 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
//! # QR code generation module.
use anyhow::Result;
use anyhow::{Result, bail};
use base64::Engine as _;
use qrcodegen::{QrCode, QrCodeEcc};
@@ -108,8 +108,18 @@ async fn generate_join_group_qr_code(context: &Context, chat_id: ChatId) -> Resu
None => None,
};
let qrcode_description = match chat.typ {
crate::constants::Chattype::Group => {
stock_str::secure_join_group_qr_description(context, &chat).await
}
crate::constants::Chattype::OutBroadcast => {
stock_str::secure_join_broadcast_qr_description(context, &chat).await
}
_ => bail!("Unexpected chat type {}", chat.typ),
};
inner_generate_secure_join_qr_code(
&stock_str::secure_join_group_qr_description(context, &chat).await,
&qrcode_description,
&securejoin::get_securejoin_qr(context, Some(chat_id)).await?,
&color_int_to_hex_string(chat.get_color(context).await?),
avatar,