feat: create_group_ex(): Log and replace invalid chat name with "…"

We can't just fail on an invalid chat name because the user would lose the work already done in the
UI like selecting members. Sometimes happens to me when i put space into name.
This commit is contained in:
iequidoo
2025-08-21 09:49:48 -03:00
committed by iequidoo
parent 2cd54b72b0
commit 11e3480fe8
2 changed files with 17 additions and 2 deletions

View File

@@ -3697,8 +3697,13 @@ pub async fn create_group_ex(
encryption: Option<ProtectionStatus>,
name: &str,
) -> Result<ChatId> {
let chat_name = sanitize_single_line(name);
ensure!(!chat_name.is_empty(), "Invalid chat name");
let mut chat_name = sanitize_single_line(name);
if chat_name.is_empty() {
// We can't just fail because the user would lose the work already done in the UI like
// selecting members.
error!(context, "Invalid chat name: {name}.");
chat_name = "".to_string();
}
let grpid = match encryption {
Some(_) => create_id(),