feat: add 'group created instructions' as info message (#4916)

Before, it was shown by UI when the chat is empty, however, in case of
verified groups, this is never the case any longer as the 'e2ee now
guaranteed' is always added.
This commit is contained in:
bjoern
2023-11-05 20:24:34 +01:00
committed by GitHub
parent fd0770859d
commit 939b4b2aab
12 changed files with 41 additions and 17 deletions

View File

@@ -3145,6 +3145,13 @@ pub async fn create_group_chat(
.await?;
}
if !context.get_config_bool(Config::Bot).await?
&& !context.get_config_bool(Config::SkipStartMessages).await?
{
let text = stock_str::new_group_send_first_message(context).await;
add_info_msg(context, chat_id, &text, create_smeared_timestamp(context)).await?;
}
Ok(chat_id)
}

View File

@@ -266,6 +266,10 @@ pub enum Config {
/// True if it is a bot account.
Bot,
/// True when to skip initial start messages in groups.
#[strum(props(default = "0"))]
SkipStartMessages,
/// Whether we send a warning if the password is wrong (set to false when we send a warning
/// because we do not want to send a second warning)
#[strum(props(default = "0"))]

View File

@@ -1315,6 +1315,7 @@ mod tests {
"send_port",
"send_security",
"server_flags",
"skip_start_messages",
"smtp_certificate_checks",
"socks5_host",
"socks5_port",

View File

@@ -413,6 +413,9 @@ pub enum StockMessage {
#[strum(props(fallback = "%1$s sent a message from another device."))]
ChatProtectionDisabled = 171,
#[strum(props(fallback = "Others will only see this group after you sent a first message."))]
NewGroupSendFirstMessage = 172,
}
impl StockMessage {
@@ -1284,6 +1287,11 @@ pub(crate) async fn aeap_explanation_and_link(
.replace2(new_addr)
}
/// Stock string: `Others will only see this group after you sent a first message.`.
pub(crate) async fn new_group_send_first_message(context: &Context) -> String {
translated(context, StockMessage::NewGroupSendFirstMessage).await
}
/// Text to put in the [`Qr::Backup`] rendered SVG image.
///
/// The default is "Scan to set up second device for <account name (account addr)>". The

View File

@@ -374,6 +374,10 @@ impl TestContext {
}
});
ctx.set_config(Config::SkipStartMessages, Some("1"))
.await
.unwrap();
Self {
ctx,
dir,