@@ -4312,6 +4312,32 @@ async fn test_no_key_contacts_in_adhoc_chats() -> Result<()> {
4312
4312
Ok ( ( ) )
4313
4313
}
4314
4314
4315
+ /// Tests that PGP-contacts cannot be added to an unencrypted (ad hoc) group and the group and
4316
+ /// messages report that they are unencrypted.
4317
+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
4318
+ async fn test_create_unencrypted_group_chat ( ) -> Result < ( ) > {
4319
+ let mut tcm = TestContextManager :: new ( ) ;
4320
+ let alice = & tcm. alice ( ) . await ;
4321
+ let bob = & tcm. bob ( ) . await ;
4322
+ let charlie = & tcm. charlie ( ) . await ;
4323
+
4324
+ let chat_id = create_group_ex ( alice, None , "Group chat" ) . await ?;
4325
+ let pgp_bob_contact_id = alice. add_or_lookup_contact_id ( bob) . await ;
4326
+ let email_charlie_contact_id = alice. add_or_lookup_email_contact_id ( charlie) . await ;
4327
+
4328
+ let res = add_contact_to_chat ( alice, chat_id, pgp_bob_contact_id) . await ;
4329
+ assert ! ( res. is_err( ) ) ;
4330
+
4331
+ add_contact_to_chat ( alice, chat_id, email_charlie_contact_id) . await ?;
4332
+
4333
+ let chat = Chat :: load_from_db ( alice, chat_id) . await ?;
4334
+ assert ! ( !chat. is_encrypted( alice) . await ?) ;
4335
+ let sent_msg = alice. send_text ( chat_id, "Hello" ) . await ;
4336
+ let msg = Message :: load_from_db ( alice, sent_msg. sender_msg_id ) . await ?;
4337
+ assert ! ( !msg. get_showpadlock( ) ) ;
4338
+ Ok ( ( ) )
4339
+ }
4340
+
4315
4341
/// Tests that avatar cannot be set in ad hoc groups.
4316
4342
#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
4317
4343
async fn test_no_avatar_in_adhoc_chats ( ) -> Result < ( ) > {
0 commit comments