diff --git a/src/download.rs b/src/download.rs
index 7919722b4..d8df94d38 100644
--- a/src/download.rs
+++ b/src/download.rs
@@ -448,10 +448,9 @@ mod tests {
)
.await?;
assert_eq!(get_chat_msgs(&bob, chat_id).await?.len(), 0);
- assert!(Message::load_from_db(&bob, msg.id)
+ assert!(Message::load_from_db_optional(&bob, msg.id)
.await?
- .chat_id
- .is_trash());
+ .is_none());
Ok(())
}
@@ -507,10 +506,9 @@ mod tests {
// (usually mdn are too small for not being downloaded directly)
receive_imf_from_inbox(&bob, "bar@example.org", raw, false, None, false).await?;
assert_eq!(get_chat_msgs(&bob, chat_id).await?.len(), 0);
- assert!(Message::load_from_db(&bob, msg.id)
+ assert!(Message::load_from_db_optional(&bob, msg.id)
.await?
- .chat_id
- .is_trash());
+ .is_none());
Ok(())
}
diff --git a/src/ephemeral.rs b/src/ephemeral.rs
index 6b62e32bf..d4951ed3e 100644
--- a/src/ephemeral.rs
+++ b/src/ephemeral.rs
@@ -1098,8 +1098,8 @@ mod tests {
})
.await;
- let loaded = Message::load_from_db(t, msg_id).await?;
- assert_eq!(loaded.chat_id, DC_CHAT_ID_TRASH);
+ let loaded = Message::load_from_db_optional(t, msg_id).await?;
+ assert!(loaded.is_none());
// Check that the msg was deleted locally.
check_msg_is_deleted(t, chat, msg_id).await;
diff --git a/src/imex.rs b/src/imex.rs
index 235c97f5e..3608ae862 100644
--- a/src/imex.rs
+++ b/src/imex.rs
@@ -1158,7 +1158,8 @@ mod tests {
// Send a message that cannot be decrypted because the keys are
// not synchronized yet.
let sent = alice2.send_text(msg.chat_id, "Test").await;
- alice.recv_msg(&sent).await;
+ let trashed_message = alice.recv_msg_opt(&sent).await;
+ assert!(trashed_message.is_none());
assert_ne!(alice.get_last_msg().await.get_text(), "Test");
// Transfer the key.
diff --git a/src/message.rs b/src/message.rs
index 4a4eaa621..f6ffd8bef 100644
--- a/src/message.rs
+++ b/src/message.rs
@@ -506,7 +506,7 @@ impl Message {
" m.location_id AS location,",
" c.blocked AS blocked",
" FROM msgs m LEFT JOIN chats c ON c.id=m.chat_id",
- " WHERE m.id=?;"
+ " WHERE m.id=? AND chat_id!=3;"
),
(id,),
|row| {
@@ -1145,13 +1145,8 @@ impl Message {
pub async fn parent(&self, context: &Context) -> Result