mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 07:16:31 +03:00
refactor: small renames
This commit is contained in:
@@ -999,7 +999,7 @@ impl CommandApi {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new **broadcast channel**
|
/// Create a new, outgoing **broadcast channel**
|
||||||
/// (called "Channel" in the UI).
|
/// (called "Channel" in the UI).
|
||||||
///
|
///
|
||||||
/// Broadcast channels are similar to groups on the sending device,
|
/// Broadcast channels are similar to groups on the sending device,
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ class Account:
|
|||||||
return Chat(self, self._rpc.create_group_chat(self.id, name, protect))
|
return Chat(self, self._rpc.create_group_chat(self.id, name, protect))
|
||||||
|
|
||||||
def create_broadcast(self, name: str) -> Chat:
|
def create_broadcast(self, name: str) -> Chat:
|
||||||
"""Create a new **broadcast channel**
|
"""Create a new, outgoing **broadcast channel**
|
||||||
(called "Channel" in the UI).
|
(called "Channel" in the UI).
|
||||||
|
|
||||||
Broadcast channels are similar to groups on the sending device,
|
Broadcast channels are similar to groups on the sending device,
|
||||||
|
|||||||
10
src/chat.rs
10
src/chat.rs
@@ -3800,7 +3800,7 @@ pub async fn create_group_ex(
|
|||||||
Ok(chat_id)
|
Ok(chat_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new **broadcast channel**
|
/// Create a new, outgoing **broadcast channel**
|
||||||
/// (called "Channel" in the UI).
|
/// (called "Channel" in the UI).
|
||||||
///
|
///
|
||||||
/// Broadcast channels are similar to groups on the sending device,
|
/// 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> {
|
pub async fn create_broadcast(context: &Context, chat_name: String) -> Result<ChatId> {
|
||||||
let grpid = create_id();
|
let grpid = create_id();
|
||||||
let secret = create_broadcast_shared_secret();
|
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 =
|
const SQL_INSERT_BROADCAST_SECRET: &str =
|
||||||
"INSERT INTO broadcasts_shared_secrets (chat_id, secret) VALUES (?, ?)
|
"INSERT INTO broadcasts_shared_secrets (chat_id, secret) VALUES (?, ?)
|
||||||
ON CONFLICT(chat_id) DO UPDATE SET secret=excluded.secret";
|
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,
|
context: &Context,
|
||||||
sync: sync::Sync,
|
sync: sync::Sync,
|
||||||
grpid: String,
|
grpid: String,
|
||||||
chat_name: String,
|
chat_name: String,
|
||||||
secret: String,
|
secret: String,
|
||||||
) -> Result<ChatId> {
|
) -> 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);
|
let chat_name = sanitize_single_line(&chat_name);
|
||||||
if chat_name.is_empty() {
|
if chat_name.is_empty() {
|
||||||
bail!("Invalid broadcast channel name: {chat_name}.");
|
bail!("Invalid broadcast channel name: {chat_name}.");
|
||||||
@@ -5251,7 +5249,7 @@ impl Context {
|
|||||||
chat_name,
|
chat_name,
|
||||||
shared_secret,
|
shared_secret,
|
||||||
} => {
|
} => {
|
||||||
create_broadcast_ex(
|
create_out_broadcast_ex(
|
||||||
self,
|
self,
|
||||||
Nosync,
|
Nosync,
|
||||||
grpid.to_string(),
|
grpid.to_string(),
|
||||||
|
|||||||
@@ -3320,7 +3320,7 @@ async fn test_encrypt_decrypt_broadcast() -> Result<()> {
|
|||||||
let alice_bob_contact_id = alice.add_or_lookup_contact_id(bob).await;
|
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");
|
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,
|
alice,
|
||||||
Sync,
|
Sync,
|
||||||
"My Channel".to_string(),
|
"My Channel".to_string(),
|
||||||
|
|||||||
@@ -1578,7 +1578,8 @@ async fn do_chat_assignment(
|
|||||||
let name =
|
let name =
|
||||||
compute_mailinglist_name(mailinglist_header, &listid, mime_parser);
|
compute_mailinglist_name(mailinglist_header, &listid, mime_parser);
|
||||||
let secret = create_broadcast_shared_secret();
|
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?
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user