refactor: small renames

This commit is contained in:
Hocuri
2025-09-10 18:51:13 +02:00
parent dca184f72c
commit a5d9d43d47
5 changed files with 9 additions and 10 deletions

View File

@@ -999,7 +999,7 @@ impl CommandApi {
.await
}
/// Create a new **broadcast channel**
/// Create a new, outgoing **broadcast channel**
/// (called "Channel" in the UI).
///
/// Broadcast channels are similar to groups on the sending device,

View File

@@ -324,7 +324,7 @@ class Account:
return Chat(self, self._rpc.create_group_chat(self.id, name, protect))
def create_broadcast(self, name: str) -> Chat:
"""Create a new **broadcast channel**
"""Create a new, outgoing **broadcast channel**
(called "Channel" in the UI).
Broadcast channels are similar to groups on the sending device,

View File

@@ -3800,7 +3800,7 @@ pub async fn create_group_ex(
Ok(chat_id)
}
/// Create a new **broadcast channel**
/// Create a new, outgoing **broadcast channel**
/// (called "Channel" in the UI).
///
/// Broadcast channels are similar to groups on the sending device,
@@ -3818,22 +3818,20 @@ pub async fn create_group_ex(
pub async fn create_broadcast(context: &Context, chat_name: String) -> Result<ChatId> {
let grpid = create_id();
let secret = create_broadcast_shared_secret();
create_broadcast_ex(context, Sync, grpid, chat_name, secret).await
create_out_broadcast_ex(context, Sync, grpid, chat_name, secret).await
}
const SQL_INSERT_BROADCAST_SECRET: &str =
"INSERT INTO broadcasts_shared_secrets (chat_id, secret) VALUES (?, ?)
ON CONFLICT(chat_id) DO UPDATE SET secret=excluded.secret";
pub(crate) async fn create_broadcast_ex(
pub(crate) async fn create_out_broadcast_ex(
context: &Context,
sync: sync::Sync,
grpid: String,
chat_name: String,
secret: String,
) -> Result<ChatId> {
// TODO check why create_group() is duplicated in receive_imf.rs, but this fn here is not
// e.g. do we need a create_blocked param?
let chat_name = sanitize_single_line(&chat_name);
if chat_name.is_empty() {
bail!("Invalid broadcast channel name: {chat_name}.");
@@ -5251,7 +5249,7 @@ impl Context {
chat_name,
shared_secret,
} => {
create_broadcast_ex(
create_out_broadcast_ex(
self,
Nosync,
grpid.to_string(),

View File

@@ -3320,7 +3320,7 @@ async fn test_encrypt_decrypt_broadcast() -> Result<()> {
let alice_bob_contact_id = alice.add_or_lookup_contact_id(bob).await;
tcm.section("Create a broadcast channel with Bob, and send a message");
let alice_chat_id = create_broadcast_ex(
let alice_chat_id = create_out_broadcast_ex(
alice,
Sync,
"My Channel".to_string(),

View File

@@ -1578,7 +1578,8 @@ async fn do_chat_assignment(
let name =
compute_mailinglist_name(mailinglist_header, &listid, mime_parser);
let secret = create_broadcast_shared_secret();
chat::create_broadcast_ex(context, Nosync, listid, name, secret).await?
chat::create_out_broadcast_ex(context, Nosync, listid, name, secret)
.await?
},
);
}