refactor: Rename chat::create_group_chat() to create_group()

If we use modules (which are actually namespaces), we can use shorter names. Another approach is to
only use modules for internal code incapsulation and use full names like deltachat-ffi does.
This commit is contained in:
iequidoo
2025-09-14 00:27:05 -03:00
committed by iequidoo
parent 04c2585c27
commit fc81cef113
19 changed files with 162 additions and 166 deletions

View File

@@ -66,8 +66,7 @@ mod test_chatlist_events {
use crate::{
EventType,
chat::{
self, ChatId, ChatVisibility, MuteDuration, create_broadcast, create_group_chat,
set_muted,
self, ChatId, ChatVisibility, MuteDuration, create_broadcast, create_group, set_muted,
},
config::Config,
constants::*,
@@ -138,7 +137,7 @@ mod test_chatlist_events {
async fn test_change_chat_visibility() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = tcm.alice().await;
let chat_id = create_group_chat(&alice, "my_group").await?;
let chat_id = create_group(&alice, "my_group").await?;
chat_id
.set_visibility(&alice, ChatVisibility::Pinned)
@@ -284,7 +283,7 @@ mod test_chatlist_events {
async fn test_delete_chat() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = tcm.alice().await;
let chat = create_group_chat(&alice, "My Group").await?;
let chat = create_group(&alice, "My Group").await?;
alice.evtracker.clear_events();
chat.delete(&alice).await?;
@@ -294,11 +293,11 @@ mod test_chatlist_events {
/// Create group chat
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_create_group_chat() -> Result<()> {
async fn test_create_group() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = tcm.alice().await;
alice.evtracker.clear_events();
let chat = create_group_chat(&alice, "My Group").await?;
let chat = create_group(&alice, "My Group").await?;
wait_for_chatlist_and_specific_item(&alice, chat).await;
Ok(())
}
@@ -319,7 +318,7 @@ mod test_chatlist_events {
async fn test_mute_chat() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = tcm.alice().await;
let chat = create_group_chat(&alice, "My Group").await?;
let chat = create_group(&alice, "My Group").await?;
alice.evtracker.clear_events();
chat::set_muted(&alice, chat, MuteDuration::Forever).await?;
@@ -338,7 +337,7 @@ mod test_chatlist_events {
async fn test_mute_chat_expired() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = tcm.alice().await;
let chat = create_group_chat(&alice, "My Group").await?;
let chat = create_group(&alice, "My Group").await?;
let mute_duration = MuteDuration::Until(
std::time::SystemTime::now()
@@ -358,7 +357,7 @@ mod test_chatlist_events {
async fn test_change_chat_name() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = tcm.alice().await;
let chat = create_group_chat(&alice, "My Group").await?;
let chat = create_group(&alice, "My Group").await?;
alice.evtracker.clear_events();
chat::set_chat_name(&alice, chat, "New Name").await?;
@@ -372,7 +371,7 @@ mod test_chatlist_events {
async fn test_change_chat_profile_image() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = tcm.alice().await;
let chat = create_group_chat(&alice, "My Group").await?;
let chat = create_group(&alice, "My Group").await?;
alice.evtracker.clear_events();
let file = alice.dir.path().join("avatar.png");
@@ -445,7 +444,7 @@ mod test_chatlist_events {
async fn test_delete_message() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = tcm.alice().await;
let chat = create_group_chat(&alice, "My Group").await?;
let chat = create_group(&alice, "My Group").await?;
let message = chat::send_text_msg(&alice, chat, "Hello World".to_owned()).await?;
alice.evtracker.clear_events();
@@ -503,7 +502,7 @@ mod test_chatlist_events {
async fn test_update_after_ephemeral_messages() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = tcm.alice().await;
let chat = create_group_chat(&alice, "My Group").await?;
let chat = create_group(&alice, "My Group").await?;
chat.set_ephemeral_timer(&alice, crate::ephemeral::Timer::Enabled { duration: 60 })
.await?;
alice
@@ -547,7 +546,7 @@ First thread."#;
let alice = tcm.alice().await;
let bob = tcm.bob().await;
let alice_chatid = chat::create_group_chat(&alice.ctx, "the chat").await?;
let alice_chatid = chat::create_group(&alice.ctx, "the chat").await?;
// Step 1: Generate QR-code, secure-join implied by chatid
let qr = get_securejoin_qr(&alice.ctx, Some(alice_chatid)).await?;
@@ -594,7 +593,7 @@ First thread."#;
async fn test_resend_message() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = tcm.alice().await;
let chat = create_group_chat(&alice, "My Group").await?;
let chat = create_group(&alice, "My Group").await?;
let msg_id = chat::send_text_msg(&alice, chat, "Hello".to_owned()).await?;
let _ = alice.pop_sent_msg().await;
@@ -614,7 +613,7 @@ First thread."#;
async fn test_reaction() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = tcm.alice().await;
let chat = create_group_chat(&alice, "My Group").await?;
let chat = create_group(&alice, "My Group").await?;
let msg_id = chat::send_text_msg(&alice, chat, "Hello".to_owned()).await?;
let _ = alice.pop_sent_msg().await;