feat: Sync Alice's verification on Bob's side

This commit is contained in:
Hocuri
2025-08-12 15:16:30 +02:00
parent 00ba559562
commit 40f4eea049
5 changed files with 51 additions and 32 deletions

View File

@@ -3133,8 +3133,19 @@ async fn test_leave_broadcast_multidevice() -> Result<()> {
alice.recv_msg_trash(&request).await;
let answer = alice.pop_sent_msg().await;
bob0.recv_msg(&answer).await;
// Sync Bob's verification of Alice:
sync(bob0, bob1).await;
// TODO uncommenting the next line creates a message "Can't decrypt outgoing messages, probably you're using DC on multiple devices without transferring your key"
// bob1.recv_msg(&request).await;
bob1.recv_msg(&answer).await;
// The 1:1 chat should not be visible to the user on any of the devices.
// The contact should be marked as verified.
check_direct_chat_is_hidden_and_contact_is_verified(alice, bob0).await;
check_direct_chat_is_hidden_and_contact_is_verified(bob0, alice).await;
check_direct_chat_is_hidden_and_contact_is_verified(bob1, alice).await;
tcm.section("Alice sends first message to broadcast.");
let sent_msg = alice.send_text(alice_chat_id, "Hello!").await;
let bob0_hello = bob0.recv_msg(&sent_msg).await;
@@ -3165,6 +3176,20 @@ async fn test_leave_broadcast_multidevice() -> Result<()> {
Ok(())
}
async fn check_direct_chat_is_hidden_and_contact_is_verified(
t: &TestContext,
contact: &TestContext,
) {
let contact = t.add_or_lookup_contact_no_key(contact).await;
if let Some(direct_chat) = ChatIdBlocked::lookup_by_contact(t, contact.id)
.await
.unwrap()
{
assert_eq!(direct_chat.blocked, Blocked::Yes);
}
assert!(contact.is_verified(t).await.unwrap());
}
/// Test that only the owner of the broadcast channel
/// can send messages into the chat.
///