@@ -5041,6 +5041,32 @@ mod tests {
5041
5041
Ok ( ( ) )
5042
5042
}
5043
5043
5044
+ #[ async_std:: test]
5045
+ async fn test_forward_info_msg ( ) -> Result < ( ) > {
5046
+ let t = TestContext :: new_alice ( ) . await ;
5047
+
5048
+ let chat_id1 = create_group_chat ( & t, ProtectionStatus :: Unprotected , "a" ) . await ?;
5049
+ send_text_msg ( & t, chat_id1, "msg one" . to_string ( ) ) . await ?;
5050
+ let bob_id =
Contact :: create ( & t
, "" , "[email protected] " ) . await ?
;
5051
+ add_contact_to_chat ( & t, chat_id1, bob_id) . await ?;
5052
+ let msg1 = t. get_last_msg_in ( chat_id1) . await ;
5053
+ assert ! ( msg1. is_info( ) ) ;
5054
+ assert ! ( msg1
. get_text
( ) . unwrap
( ) . contains
( "[email protected] " ) ) ;
5055
+
5056
+ let chat_id2 = ChatId :: create_for_contact ( & t, bob_id) . await ?;
5057
+ assert_eq ! ( get_chat_msgs( & t, chat_id2, 0 ) . await ?. len( ) , 0 ) ;
5058
+ forward_msgs ( & t, & [ msg1. id ] , chat_id2) . await ?;
5059
+ let msg2 = t. get_last_msg_in ( chat_id2) . await ;
5060
+ assert ! ( !msg2. is_info( ) ) ; // forwarded info-messages lose their info-state
5061
+ assert_eq ! ( msg2. get_info_type( ) , SystemMessage :: Unknown ) ;
5062
+ assert_ne ! ( msg2. from_id, ContactId :: INFO ) ;
5063
+ assert_ne ! ( msg2. to_id, ContactId :: INFO ) ;
5064
+ assert_eq ! ( msg2. get_text( ) . unwrap( ) , msg1. get_text( ) . unwrap( ) ) ;
5065
+ assert ! ( msg2. is_forwarded( ) ) ;
5066
+
5067
+ Ok ( ( ) )
5068
+ }
5069
+
5044
5070
#[ async_std:: test]
5045
5071
async fn test_forward_quote ( ) -> Result < ( ) > {
5046
5072
let alice = TestContext :: new_alice ( ) . await ;
0 commit comments