refactor: Unify naming of direct/single/1:1/normal chats (#8442)

Unifies internal naming of single/direct/1:1/normal chats
to match the naming used in the API.

Closes: #8368
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>

---------

Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
This commit is contained in:
Jagoda Estera Ślązak
2026-07-27 16:31:09 +02:00
committed by GitHub
parent df4197df56
commit afb1d0dba8
36 changed files with 212 additions and 222 deletions

View File

@@ -59,7 +59,7 @@ static MSGRMSG: &[u8] =
\n\
hello\n";
static ONETOONE_NOREPLY_MAIL: &[u8] =
static SINGLE_NOREPLY_MAIL: &[u8] =
b"Received: (Postfix, from userid 1000); Mon, 4 Dec 2006 14:51:39 +0100 (CET)\n\
From: Bob <bob@example.com>\n\
To: alice@example.org\n\
@@ -91,7 +91,7 @@ async fn test_adhoc_group_is_shown() {
let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap();
assert_eq!(chats.len(), 1);
receive_imf(&t, ONETOONE_NOREPLY_MAIL, false).await.unwrap();
receive_imf(&t, SINGLE_NOREPLY_MAIL, false).await.unwrap();
let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap();
assert_eq!(chats.len(), 1);
@@ -121,7 +121,7 @@ async fn test_adhoc_group_show_accepted_contact_accepted() {
assert_eq!(chat::get_chat_msgs(&t, chat_id).await.unwrap().len(), 1);
// receive a non-delta-message from Bob, shows up because of the show_emails setting
receive_imf(&t, ONETOONE_NOREPLY_MAIL, false).await.unwrap();
receive_imf(&t, SINGLE_NOREPLY_MAIL, false).await.unwrap();
assert_eq!(chat::get_chat_msgs(&t, chat_id).await.unwrap().len(), 2);
@@ -2158,7 +2158,7 @@ Original signature",
)
.await?;
let msg = t.get_last_msg().await;
let one2one_chat_id = msg.chat_id;
let single_chat_id = msg.chat_id;
let bob = Contact::get_by_id(&t, bob_id).await?;
assert_eq!(bob.get_status(), "Original signature");
assert!(!msg.has_html());
@@ -2201,7 +2201,7 @@ Original signature updated",
.await?;
let bob = Contact::get_by_id(&t, bob_id).await?;
assert_eq!(bob.get_status(), "Original signature updated");
assert_eq!(get_chat_msgs(&t, one2one_chat_id).await?.len(), 2);
assert_eq!(get_chat_msgs(&t, single_chat_id).await?.len(), 2);
assert_eq!(get_chat_msgs(&t, ml_chat_id).await?.len(), 1);
assert_eq!(Chatlist::try_load(&t, 0, None, None).await?.len(), 2);
Ok(())
@@ -3276,7 +3276,7 @@ async fn test_no_private_reply_to_blocked_account() -> Result<()> {
/// Regression test for two bugs:
///
/// 1. If you blocked some spammer using DC, the 1:1 messages with that contact
/// 1. If you blocked some spammer using DC, the single chat messages with that contact
/// are not received, but they could easily bypass this restriction creating
/// a new group with only you two as member.
/// 2. A blocked group was sometimes not unblocked when when an unblocked
@@ -3707,7 +3707,7 @@ async fn test_mua_user_adds_recipient_to_single_chat() -> Result<()> {
let alice = TestContext::new_alice().await;
alice.allow_unencrypted().await?;
// Alice sends a 1:1 message to Bob, creating a 1:1 chat.
// Alice sends a message to Bob, creating a single chat.
let msg = receive_imf(
&alice,
b"Subject: =?utf-8?q?Message_from_alice=40example=2Eorg?=\r\n\
@@ -3725,7 +3725,7 @@ async fn test_mua_user_adds_recipient_to_single_chat() -> Result<()> {
let single_chat = Chat::load_from_db(&alice, msg.chat_id).await?;
assert_eq!(single_chat.typ, Chattype::Single);
// Bob uses a classical MUA to answer in the 1:1 chat.
// Bob uses a classical MUA to answer in the single chat.
let msg2 = receive_imf(
&alice,
b"Subject: Re: Message from alice\r\n\
@@ -3761,10 +3761,7 @@ async fn test_mua_user_adds_recipient_to_single_chat() -> Result<()> {
assert_ne!(msg3.chat_id, single_chat.id);
let group_chat = Chat::load_from_db(&alice, msg3.chat_id).await?;
assert_eq!(group_chat.typ, Chattype::Group);
assert_eq!(
chat::get_chat_contacts(&alice, group_chat.id).await?.len(),
3
);
assert_eq!(get_chat_contacts(&alice, group_chat.id).await?.len(), 3);
// Bob uses a classical MUA to answer once more, adding another recipient.
// This new recipient should also be added to the group.
@@ -3783,15 +3780,12 @@ async fn test_mua_user_adds_recipient_to_single_chat() -> Result<()> {
.await?
.unwrap();
assert_eq!(msg4.chat_id, group_chat.id);
assert_eq!(
chat::get_chat_contacts(&alice, group_chat.id).await?.len(),
4
);
assert_eq!(get_chat_contacts(&alice, group_chat.id).await?.len(), 4);
let fiona_contact_id =
Contact::lookup_id_by_addr(&alice, "fiona@example.net", Origin::IncomingTo)
.await?
.unwrap();
assert!(chat::is_contact_in_chat(&alice, group_chat.id, fiona_contact_id).await?);
assert!(is_contact_in_chat(&alice, group_chat.id, fiona_contact_id).await?);
let fiona_contact = Contact::get_by_id(&alice, fiona_contact_id).await?;
assert_eq!(fiona_contact.is_key_contact(), false);
@@ -5169,7 +5163,7 @@ async fn test_dont_verify_by_verified_by_unknown() -> Result<()> {
}
/// Tests that second device assigns outgoing encrypted messages
/// to 1:1 chat with key-contact even if the key of the contact is unknown.
/// to a single chat with key-contact even if the key of the contact is unknown.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_recv_outgoing_msg_before_securejoin() -> Result<()> {
let mut tcm = TestContextManager::new();
@@ -5182,7 +5176,7 @@ async fn test_recv_outgoing_msg_before_securejoin() -> Result<()> {
let sent_msg = a0.send_text(chat_id_a0_bob, "Hi").await;
// Device a1 does not have Bob's key.
// Message is still received in an encrypted 1:1 chat with Bob.
// Message is still received in an encrypted single chat with Bob.
// a1 learns the fingerprint of Bob from the Intended Recipient Fingerprint packet,
// but not the key.
let msg_a1 = a1.recv_msg(&sent_msg).await;
@@ -5209,7 +5203,7 @@ async fn test_recv_outgoing_msg_before_securejoin() -> Result<()> {
Ok(())
}
/// Tests that outgoing message cannot be assigned to 1:1 chat
/// Tests that outgoing message cannot be assigned to a single chat
/// without the intended recipient fingerprint.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_recv_outgoing_msg_no_intended_recipient_fingerprint() -> Result<()> {
@@ -5563,7 +5557,7 @@ async fn test_encrypted_adhoc_group_message() -> Result<()> {
/// Tests that messages sent to unencrypted group
/// with only two members arrive in a group
/// and not in 1:1 chat.
/// and not in a single chat.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_small_unencrypted_group() -> Result<()> {
let mut tcm = TestContextManager::new();