mirror of
https://github.com/chatmail/core.git
synced 2026-05-01 20:36:31 +03:00
fix: return correct MsgId for malformed message tombstone
.execute() returns the number of affected rows, in this case it is always 1 and MsgId(1) is returned instead of the actual tombstone row ID.
This commit is contained in:
@@ -139,7 +139,7 @@ pub(crate) async fn receive_imf_inner(
|
|||||||
|
|
||||||
let row_id = context
|
let row_id = context
|
||||||
.sql
|
.sql
|
||||||
.execute(
|
.insert(
|
||||||
"INSERT INTO msgs(rfc724_mid, chat_id) VALUES (?,?)",
|
"INSERT INTO msgs(rfc724_mid, chat_id) VALUES (?,?)",
|
||||||
(rfc724_mid, DC_CHAT_ID_TRASH),
|
(rfc724_mid, DC_CHAT_ID_TRASH),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ async fn test_no_from() {
|
|||||||
let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap();
|
let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap();
|
||||||
assert!(chats.get_msg_id(0).is_err());
|
assert!(chats.get_msg_id(0).is_err());
|
||||||
|
|
||||||
receive_imf(
|
let received = receive_imf(
|
||||||
context,
|
context,
|
||||||
b"Received: (Postfix, from userid 1000); Mon, 4 Dec 2006 14:51:39 +0100 (CET)\n\
|
b"Received: (Postfix, from userid 1000); Mon, 4 Dec 2006 14:51:39 +0100 (CET)\n\
|
||||||
To: bob@example.com\n\
|
To: bob@example.com\n\
|
||||||
@@ -335,8 +335,13 @@ async fn test_no_from() {
|
|||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
|
.unwrap()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
// Check that tombstone MsgId is returned.
|
||||||
|
assert_eq!(received.msg_ids.len(), 1);
|
||||||
|
assert!(!received.msg_ids[0].is_special());
|
||||||
|
|
||||||
let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap();
|
let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap();
|
||||||
// Check that the message is not shown to the user:
|
// Check that the message is not shown to the user:
|
||||||
assert!(chats.is_empty());
|
assert!(chats.is_empty());
|
||||||
|
|||||||
Reference in New Issue
Block a user