@@ -684,9 +684,6 @@ async fn secure_connection_established(
684
684
contact_id : ContactId ,
685
685
chat_id : ChatId ,
686
686
) -> Result < ( ) > {
687
- let contact = Contact :: get_by_id ( context, contact_id) . await ?;
688
- let msg = stock_str:: contact_verified ( context, & contact) . await ;
689
- chat:: add_info_msg ( context, chat_id, & msg, time ( ) ) . await ?;
690
687
if context
691
688
. get_config_bool ( Config :: VerifiedOneOnOneChats )
692
689
. await ?
@@ -924,25 +921,10 @@ mod tests {
924
921
// Check Alice got the verified message in her 1:1 chat.
925
922
{
926
923
let chat = alice. create_chat ( & bob) . await ;
927
- let msg_ids: Vec < _ > = chat:: get_chat_msgs ( & alice. ctx , chat. get_id ( ) )
928
- . await
929
- . unwrap ( )
930
- . into_iter ( )
931
- . filter_map ( |item| match item {
932
- chat:: ChatItem :: Message { msg_id } => Some ( msg_id) ,
933
- _ => None ,
934
- } )
935
- . collect ( ) ;
936
- assert_eq ! ( msg_ids. len( ) , 2 ) ;
937
-
938
- let msg0 = Message :: load_from_db ( & alice. ctx , msg_ids[ 0 ] ) . await . unwrap ( ) ;
939
- assert ! ( msg0. is_info( ) ) ;
940
- assert ! ( msg0
. get_text
( ) . contains
( "[email protected] verified" ) ) ;
941
-
942
- let msg1 = Message :: load_from_db ( & alice. ctx , msg_ids[ 1 ] ) . await . unwrap ( ) ;
943
- assert ! ( msg1. is_info( ) ) ;
924
+ let msg = get_chat_msg ( & alice, chat. get_id ( ) , 0 , 1 ) . await ;
925
+ assert ! ( msg. is_info( ) ) ;
944
926
let expected_text = chat_protection_enabled ( & alice) . await ;
945
- assert_eq ! ( msg1 . get_text( ) , expected_text) ;
927
+ assert_eq ! ( msg . get_text( ) , expected_text) ;
946
928
}
947
929
948
930
// Check Alice sent the right message to Bob.
@@ -978,24 +960,10 @@ mod tests {
978
960
// Check Bob got the verified message in his 1:1 chat.
979
961
{
980
962
let chat = bob. create_chat ( & alice) . await ;
981
- let msg_ids: Vec < _ > = chat:: get_chat_msgs ( & bob. ctx , chat. get_id ( ) )
982
- . await
983
- . unwrap ( )
984
- . into_iter ( )
985
- . filter_map ( |item| match item {
986
- chat:: ChatItem :: Message { msg_id } => Some ( msg_id) ,
987
- _ => None ,
988
- } )
989
- . collect ( ) ;
990
-
991
- let msg0 = Message :: load_from_db ( & bob. ctx , msg_ids[ 0 ] ) . await . unwrap ( ) ;
992
- assert ! ( msg0. is_info( ) ) ;
993
- assert ! ( msg0
. get_text
( ) . contains
( "[email protected] verified" ) ) ;
994
-
995
- let msg1 = Message :: load_from_db ( & bob. ctx , msg_ids[ 1 ] ) . await . unwrap ( ) ;
996
- assert ! ( msg1. is_info( ) ) ;
963
+ let msg = get_chat_msg ( & bob, chat. get_id ( ) , 0 , 1 ) . await ;
964
+ assert ! ( msg. is_info( ) ) ;
997
965
let expected_text = chat_protection_enabled ( & bob) . await ;
998
- assert_eq ! ( msg1 . get_text( ) , expected_text) ;
966
+ assert_eq ! ( msg . get_text( ) , expected_text) ;
999
967
}
1000
968
1001
969
// Check Bob sent the final message
@@ -1294,11 +1262,11 @@ mod tests {
1294
1262
) ;
1295
1263
// There should be 3 messages in the chat:
1296
1264
// - The ChatProtectionEnabled message
1297
-
1298
1265
// - You added member [email protected]
1299
- let msg = get_chat_msg ( & alice, alice_chatid, 1 , 3 ) . await ;
1266
+ let msg = get_chat_msg ( & alice, alice_chatid, 0 , 2 ) . await ;
1300
1267
assert ! ( msg. is_info( ) ) ;
1301
- assert ! ( msg
. get_text
( ) . contains
( "[email protected] verified" ) ) ;
1268
+ let expected_text = chat_protection_enabled ( & alice) . await ;
1269
+ assert_eq ! ( msg. get_text( ) , expected_text) ;
1302
1270
}
1303
1271
1304
1272
// Bob should not yet have Alice verified
@@ -1334,27 +1302,6 @@ mod tests {
1334
1302
println ! ( "msg {msg_id} text: {text}" ) ;
1335
1303
}
1336
1304
}
1337
- let mut msg_iter = chat:: get_chat_msgs ( & bob. ctx , bob_chatid)
1338
- . await
1339
- . unwrap ( )
1340
- . into_iter ( ) ;
1341
- loop {
1342
- match msg_iter. next ( ) {
1343
- Some ( chat:: ChatItem :: Message { msg_id } ) => {
1344
- let msg = Message :: load_from_db ( & bob. ctx , msg_id) . await . unwrap ( ) ;
1345
- let text = msg. get_text ( ) ;
1346
- match text
. contains ( "[email protected] verified" ) {
1347
- true => {
1348
- assert ! ( msg. is_info( ) ) ;
1349
- break ;
1350
- }
1351
- false => continue ,
1352
- }
1353
- }
1354
- Some ( _) => continue ,
1355
- None => panic ! ( "Verified message not found in Bob's group chat" ) ,
1356
- }
1357
- }
1358
1305
}
1359
1306
1360
1307
let sent = bob. pop_sent_msg ( ) . await ;
0 commit comments