@@ -4,7 +4,7 @@ use super::*;
4
4
use crate :: chat:: { Chat , ProtectionStatus , get_chat_contacts, send_text_msg} ;
5
5
use crate :: chatlist:: Chatlist ;
6
6
use crate :: receive_imf:: receive_imf;
7
- use crate :: test_utils:: { self , TestContext , TestContextManager , TimeShiftFalsePositiveNote } ;
7
+ use crate :: test_utils:: { self , TestContext , TestContextManager , TimeShiftFalsePositiveNote , sync } ;
8
8
9
9
#[ test]
10
10
fn test_contact_id_values ( ) {
@@ -831,8 +831,7 @@ CCCB 5AA9 F6E1 141C 9431
831
831
Ok ( ( ) )
832
832
}
833
833
834
- /// Tests that status is synchronized when sending encrypted BCC-self messages and not
835
- /// synchronized when the message is not encrypted.
834
+ /// Tests that self-status is not synchronized from outgoing messages.
836
835
#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
837
836
async fn test_synchronize_status ( ) -> Result < ( ) > {
838
837
let mut tcm = TestContextManager :: new ( ) ;
@@ -851,39 +850,22 @@ async fn test_synchronize_status() -> Result<()> {
851
850
. await ?;
852
851
let chat = alice1. create_email_chat ( bob) . await ;
853
852
854
- // Alice sends a message to Bob from the first device.
853
+ // Alice sends an unencrypted message to Bob from the first device.
855
854
send_text_msg ( alice1, chat. id , "Hello" . to_string ( ) ) . await ?;
856
855
let sent_msg = alice1. pop_sent_msg ( ) . await ;
857
856
858
- // Message is not encrypted.
859
- let message = sent_msg. load_from_db ( ) . await ;
860
- assert ! ( !message. get_showpadlock( ) ) ;
861
-
862
857
// Alice's second devices receives a copy of outgoing message.
863
858
alice2. recv_msg ( & sent_msg) . await ;
864
-
865
- // Bob receives message.
866
- bob. recv_msg ( & sent_msg) . await ;
867
-
868
- // Message was not encrypted, so status is not copied.
869
859
assert_eq ! ( alice2. get_config( Config :: Selfstatus ) . await ?, default_status) ;
870
860
871
861
// Alice sends encrypted message.
872
862
let chat = alice1. create_chat ( bob) . await ;
873
863
send_text_msg ( alice1, chat. id , "Hello" . to_string ( ) ) . await ?;
874
864
let sent_msg = alice1. pop_sent_msg ( ) . await ;
875
865
876
- // Second message is encrypted.
877
- let message = sent_msg. load_from_db ( ) . await ;
878
- assert ! ( message. get_showpadlock( ) ) ;
879
-
880
866
// Alice's second devices receives a copy of second outgoing message.
881
867
alice2. recv_msg ( & sent_msg) . await ;
882
-
883
- assert_eq ! (
884
- alice2. get_config( Config :: Selfstatus ) . await ?,
885
- Some ( "New status" . to_string( ) )
886
- ) ;
868
+ assert_eq ! ( alice2. get_config( Config :: Selfstatus ) . await ?, default_status) ;
887
869
888
870
Ok ( ( ) )
889
871
}
@@ -896,9 +878,9 @@ async fn test_selfavatar_changed_event() -> Result<()> {
896
878
// Alice has two devices.
897
879
let alice1 = & tcm. alice ( ) . await ;
898
880
let alice2 = & tcm. alice ( ) . await ;
899
-
900
- // Bob has one device.
901
- let bob = & tcm . bob ( ) . await ;
881
+ for a in [ alice1 , alice2 ] {
882
+ a . set_config_bool ( Config :: SyncMsgs , true ) . await ? ;
883
+ }
902
884
903
885
assert_eq ! ( alice1. get_config( Config :: Selfavatar ) . await ?, None ) ;
904
886
@@ -914,17 +896,7 @@ async fn test_selfavatar_changed_event() -> Result<()> {
914
896
. get_matching ( |e| matches ! ( e, EventType :: SelfavatarChanged ) )
915
897
. await ;
916
898
917
- // Alice sends a message.
918
- let alice1_chat_id = alice1. create_chat ( bob) . await . id ;
919
- send_text_msg ( alice1, alice1_chat_id, "Hello" . to_string ( ) ) . await ?;
920
- let sent_msg = alice1. pop_sent_msg ( ) . await ;
921
-
922
- // The message is encrypted.
923
- let message = sent_msg. load_from_db ( ) . await ;
924
- assert ! ( message. get_showpadlock( ) ) ;
925
-
926
- // Alice's second device receives a copy of the outgoing message.
927
- alice2. recv_msg ( & sent_msg) . await ;
899
+ sync ( alice1, alice2) . await ;
928
900
929
901
// Alice's second device applies the selfavatar.
930
902
assert ! ( alice2. get_config( Config :: Selfavatar ) . await ?. is_some( ) ) ;
0 commit comments