@@ -4855,6 +4855,37 @@ async fn test_protected_group_add_remove_member_missing_key() -> Result<()> {
48554855 Ok ( ( ) )
48564856}
48574857
4858+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
4859+ async fn test_protected_group_reply_from_mua ( ) -> Result < ( ) > {
4860+ let mut tcm = TestContextManager :: new ( ) ;
4861+ let alice = & tcm. alice ( ) . await ;
4862+ let bob = & tcm. bob ( ) . await ;
4863+ let fiona = & tcm. fiona ( ) . await ;
4864+ mark_as_verified ( alice, bob) . await ;
4865+ mark_as_verified ( alice, fiona) . await ;
4866+ mark_as_verified ( bob, alice) . await ;
4867+ let alice_chat_id = alice
4868+ . create_group_with_members ( ProtectionStatus :: Protected , "Group" , & [ bob, fiona] )
4869+ . await ;
4870+ let sent = alice. send_text ( alice_chat_id, "Hello!" ) . await ;
4871+ let bob_msg = bob. recv_msg ( & sent) . await ;
4872+ bob_msg. chat_id . accept ( bob) . await ?;
4873+ // This is hacky, but i don't know other simple way to simulate a MUA reply. It works because
4874+ // the message is correctly assigned to the chat by `References:`.
4875+ bob. sql
4876+ . execute (
4877+ "UPDATE chats SET protected=0, grpid='' WHERE id=?" ,
4878+ ( bob_msg. chat_id , ) ,
4879+ )
4880+ . await ?;
4881+ let sent = bob
4882+ . send_text ( bob_msg. chat_id , "/me replying from MUA" )
4883+ . await ;
4884+ let alice_msg = alice. recv_msg ( & sent) . await ;
4885+ assert_eq ! ( alice_msg. chat_id, alice_chat_id) ;
4886+ Ok ( ( ) )
4887+ }
4888+
48584889#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
48594890async fn test_older_message_from_2nd_device ( ) -> Result < ( ) > {
48604891 let mut tcm = TestContextManager :: new ( ) ;
0 commit comments