mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 15:36:30 +03:00
Move module functions to type methods
This moves the module-level lookup and creation functions to the types, which make the naming more consistent. Now the lookup_* get_* and create_* functions all behave similarly. Peraps even more important the API of the lookup now allows distinguishing failure from not found. This in turn is important to be able to remove reliance on a ChatId with a 0 or "unset" value. The locations where this ChatId(0) is still used is in database queries which should be solved in an independed commit.
This commit is contained in:
@@ -609,8 +609,7 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::chat::{
|
||||
create_by_contact_id, get_chat_contacts, get_chat_msgs, send_msg, set_muted, Chat,
|
||||
MuteDuration,
|
||||
get_chat_contacts, get_chat_msgs, send_msg, set_muted, Chat, ChatId, MuteDuration,
|
||||
};
|
||||
use crate::constants::{Viewtype, DC_CONTACT_ID_SELF};
|
||||
use crate::dc_receive_imf::dc_receive_imf;
|
||||
@@ -893,7 +892,7 @@ mod tests {
|
||||
#[async_std::test]
|
||||
async fn test_search_msgs() -> Result<()> {
|
||||
let alice = TestContext::new_alice().await;
|
||||
let self_talk = create_by_contact_id(&alice, DC_CONTACT_ID_SELF).await?;
|
||||
let self_talk = ChatId::create_for_contact(&alice, DC_CONTACT_ID_SELF).await?;
|
||||
let chat = alice
|
||||
.create_chat_with_contact("Bob", "bob@example.org")
|
||||
.await;
|
||||
|
||||
Reference in New Issue
Block a user