mirror of
https://github.com/chatmail/core.git
synced 2026-10-01 18:50:39 +03:00
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:
+13
-13
@@ -242,7 +242,7 @@ impl TestContextManager {
|
||||
|
||||
/// Executes SecureJoin protocol between `scanner` and `scanned`.
|
||||
///
|
||||
/// Returns chat ID of the 1:1 chat for `scanner`.
|
||||
/// Returns chat ID of the single chat for `scanner`.
|
||||
pub async fn execute_securejoin(&self, scanner: &TestContext, scanned: &TestContext) -> ChatId {
|
||||
self.section(&format!(
|
||||
"{} scans {}'s QR code",
|
||||
@@ -256,7 +256,7 @@ impl TestContextManager {
|
||||
|
||||
/// Executes SecureJoin initiated by `joiner` scanning `qr` generated by `inviter`.
|
||||
///
|
||||
/// The [`ChatId`] of the created chat is returned, for a SetupContact QR this is the 1:1
|
||||
/// The [`ChatId`] of the created chat is returned, for a SetupContact QR this is the single
|
||||
/// chat with `inviter`, for a SecureJoin QR this is the group chat.
|
||||
pub async fn exec_securejoin_qr(
|
||||
&self,
|
||||
@@ -273,7 +273,7 @@ impl TestContextManager {
|
||||
/// `inviters` devices must have the same primary address.
|
||||
/// All of the `inviters` devices will get the messages and send replies.
|
||||
///
|
||||
/// The [`ChatId`] of the created chat is returned, for a SetupContact QR this is the 1:1
|
||||
/// The [`ChatId`] of the created chat is returned, for a SetupContact QR this is the single
|
||||
/// chat with the inviter, for a SecureJoin QR this is the group chat.
|
||||
pub async fn exec_securejoin_qr_multi_device(
|
||||
&self,
|
||||
@@ -951,12 +951,12 @@ ORDER BY id"
|
||||
contact_id
|
||||
}
|
||||
|
||||
/// Returns 1:1 [`Chat`] with another account address-contact.
|
||||
/// Returns a single [`Chat`] with another account address-contact.
|
||||
/// Panics if it doesn't exist.
|
||||
/// May return a blocked chat.
|
||||
///
|
||||
/// This first creates a contact using the configured details on the other account, then
|
||||
/// gets the 1:1 chat with this contact.
|
||||
/// gets the single chat with this contact.
|
||||
pub async fn get_email_chat(&self, other: &TestContext) -> Chat {
|
||||
let contact = self.add_or_lookup_address_contact(other).await;
|
||||
|
||||
@@ -972,7 +972,7 @@ ORDER BY id"
|
||||
Chat::load_from_db(&self.ctx, chat_id).await.unwrap()
|
||||
}
|
||||
|
||||
/// Returns 1:1 [`Chat`] with another account key-contact.
|
||||
/// Returns a single [`Chat`] with another account key-contact.
|
||||
/// Panics if the chat does not exist.
|
||||
///
|
||||
/// This first creates a contact, but does not import the key,
|
||||
@@ -993,27 +993,27 @@ ORDER BY id"
|
||||
Chat::load_from_db(&self.ctx, chat_id).await.unwrap()
|
||||
}
|
||||
|
||||
/// Creates or returns an existing 1:1 [`ChatId`] with another account.
|
||||
/// Creates or returns an existing single [`ChatId`] with another account.
|
||||
///
|
||||
/// This first creates a contact by exporting a vCard from the `other`
|
||||
/// and importing it into `self`,
|
||||
/// then creates a 1:1 chat with this contact.
|
||||
/// then creates a single chat with this contact.
|
||||
pub async fn create_chat_id(&self, other: &TestContext) -> ChatId {
|
||||
let contact_id = self.add_or_lookup_contact_id(other).await;
|
||||
ChatId::create_for_contact(self, contact_id).await.unwrap()
|
||||
}
|
||||
|
||||
/// Creates or returns an existing 1:1 [`Chat`] with another account.
|
||||
/// Creates or returns an existing single [`Chat`] with another account.
|
||||
///
|
||||
/// This first creates a contact by exporting a vCard from the `other`
|
||||
/// and importing it into `self`,
|
||||
/// then creates a 1:1 chat with this contact.
|
||||
/// then creates a single chat with this contact.
|
||||
pub async fn create_chat(&self, other: &TestContext) -> Chat {
|
||||
let chat_id = self.create_chat_id(other).await;
|
||||
Chat::load_from_db(self, chat_id).await.unwrap()
|
||||
}
|
||||
|
||||
/// Creates or returns an existing 1:1 [`Chat`] with another account
|
||||
/// Creates or returns an existing single [`Chat`] with another account
|
||||
/// by email address.
|
||||
///
|
||||
/// This function can be used to create unencrypted chats.
|
||||
@@ -1024,9 +1024,9 @@ ORDER BY id"
|
||||
Chat::load_from_db(self, chat_id).await.unwrap()
|
||||
}
|
||||
|
||||
/// Creates or returns an existing [`Contact`] and 1:1 [`Chat`] with another email.
|
||||
/// Creates or returns an existing [`Contact`] and single [`Chat`] with another email.
|
||||
///
|
||||
/// This first creates a contact from the `name` and `addr` and then creates a 1:1 chat
|
||||
/// This first creates a contact from the `name` and `addr` and then creates a single chat
|
||||
/// with this contact.
|
||||
pub async fn create_chat_with_contact(&self, name: &str, addr: &str) -> Chat {
|
||||
let contact = Contact::create(self, name, addr)
|
||||
|
||||
Reference in New Issue
Block a user