@@ -1982,3 +1982,32 @@ async fn test_chat_edit_imf_header() -> Result<()> {
1982
1982
1983
1983
Ok ( ( ) )
1984
1984
}
1985
+
1986
+ /// Tests that timestamp of signed but not encrypted message is protected.
1987
+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
1988
+ async fn test_protected_date ( ) -> Result < ( ) > {
1989
+ let mut tcm = TestContextManager :: new ( ) ;
1990
+ let alice = & tcm. alice ( ) . await ;
1991
+ let bob = & tcm. bob ( ) . await ;
1992
+
1993
+ alice. set_config ( Config :: SignUnencrypted , Some ( "1" ) ) . await ?;
1994
+
1995
+ let alice_chat = alice. create_email_chat ( bob) . await ;
1996
+ let alice_msg_id = chat:: send_text_msg ( alice, alice_chat. id , "Hello!" . to_string ( ) ) . await ?;
1997
+ let alice_msg = Message :: load_from_db ( alice, alice_msg_id) . await ?;
1998
+ assert_eq ! ( alice_msg. get_showpadlock( ) , false ) ;
1999
+
2000
+ let mut sent_msg = alice. pop_sent_msg ( ) . await ;
2001
+ sent_msg. payload = sent_msg. payload . replacen (
2002
+ "Date:" ,
2003
+ "Date: Wed, 17 Mar 2021 14:30:53 +0100 (CET)\r \n X-Not-Date:" ,
2004
+ 1 ,
2005
+ ) ;
2006
+ let bob_msg = bob. recv_msg ( & sent_msg) . await ;
2007
+ assert_eq ! ( alice_msg. get_text( ) , bob_msg. get_text( ) ) ;
2008
+
2009
+ // Timestamp that the sender has put into the message
2010
+ // should always be displayed as is on the receiver.
2011
+ assert_eq ! ( alice_msg. get_timestamp( ) , bob_msg. get_timestamp( ) ) ;
2012
+ Ok ( ( ) )
2013
+ }
0 commit comments