api: don't load trashed messages with Message::load_from_db

API now pretends that trashed messages don't exist.
This way callers don't have to check if loaded message
belongs to trash chat.
If message may be trashed by the time it is attempted to be loaded,
callers should use Message::load_from_db_optional.

Most changes are around receive_status_update() function
because previously it relied on loading trashed status update
messages immediately after adding them to the database.
This commit is contained in:
link2xt
2024-04-13 23:34:09 +00:00
parent 94ac2b1097
commit c069190b68
11 changed files with 161 additions and 116 deletions

View File

@@ -571,7 +571,7 @@ mod tests {
let sent_msg = alice.pop_sent_msg().await;
let alice2 = TestContext::new_alice().await;
alice2.set_config_bool(Config::SyncMsgs, true).await?;
alice2.recv_msg(&sent_msg).await;
alice2.recv_msg_trash(&sent_msg).await;
assert!(token::exists(&alice2, token::Namespace::Auth, "testtoken").await?);
assert_eq!(Chatlist::try_load(&alice2, 0, None, None).await?.len(), 0);