Skip to content

Commit 688605c

Browse files
committed
test: Encrypted message goes to encrypted 1:1 chat even if references messages in ad-hoc group
This is an important thing forgotten to be checked in 3325270.
1 parent 448c0d2 commit 688605c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/receive_imf/receive_imf_tests.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5117,6 +5117,7 @@ async fn test_recv_outgoing_msg_before_securejoin() -> Result<()> {
51175117
tcm.execute_securejoin(bob, a0).await;
51185118
let chat_id_a0_bob = a0.create_chat_id(bob).await;
51195119
let sent_msg = a0.send_text(chat_id_a0_bob, "Hi").await;
5120+
bob.recv_msg(&sent_msg).await;
51205121
let msg_a1 = a1.recv_msg(&sent_msg).await;
51215122
assert!(msg_a1.get_showpadlock());
51225123
let chat_a1 = Chat::load_from_db(a1, msg_a1.chat_id).await?;
@@ -5132,6 +5133,7 @@ async fn test_recv_outgoing_msg_before_securejoin() -> Result<()> {
51325133
);
51335134

51345135
let sent_msg = a0.send_text(chat_id_a0_bob, "Hi again").await;
5136+
bob.recv_msg(&sent_msg).await;
51355137
let msg_a1 = a1.recv_msg(&sent_msg).await;
51365138
assert!(msg_a1.get_showpadlock());
51375139
assert_eq!(msg_a1.chat_id, chat_a1.id);
@@ -5140,6 +5142,17 @@ async fn test_recv_outgoing_msg_before_securejoin() -> Result<()> {
51405142
chat_a1.why_cant_send(a1).await?,
51415143
Some(CantSendReason::NotAMember)
51425144
);
5145+
5146+
let msg_a1 = tcm.send_recv(bob, a1, "Hi back").await;
5147+
assert!(msg_a1.get_showpadlock());
5148+
let chat_a1 = Chat::load_from_db(a1, msg_a1.chat_id).await?;
5149+
assert_eq!(chat_a1.typ, Chattype::Single);
5150+
assert!(chat_a1.is_encrypted(a1).await?);
5151+
// Weird, but fine, anyway the bigger problem is the conversation split into two chats.
5152+
assert_eq!(
5153+
chat_a1.why_cant_send(a1).await?,
5154+
Some(CantSendReason::ContactRequest)
5155+
);
51435156
Ok(())
51445157
}
51455158

0 commit comments

Comments
 (0)