diff --git a/src/message.rs b/src/message.rs index 166e2d8fc..2711c5bf5 100644 --- a/src/message.rs +++ b/src/message.rs @@ -1663,7 +1663,8 @@ pub(crate) async fn update_msg_state( msg_id: MsgId, state: MessageState, ) -> Result<()> { - let error_subst = match state >= MessageState::OutDelivered { + ensure!(state != MessageState::OutFailed, "use set_msg_failed()!"); + let error_subst = match state >= MessageState::OutPending { true => ", error=''", false => "", }; diff --git a/src/receive_imf/tests.rs b/src/receive_imf/tests.rs index c7004211f..6a561ef5c 100644 --- a/src/receive_imf/tests.rs +++ b/src/receive_imf/tests.rs @@ -689,6 +689,9 @@ async fn test_resend_after_ndn() -> Result<()> { ) .await; chat::resend_msgs(&t, &[msg_id]).await?; + let msg = Message::load_from_db(&t, msg_id).await?; + assert_eq!(msg.state, MessageState::OutPending); + assert_eq!(msg.error(), None); // Alice receives a BCC-self copy of their message. receive_imf( &t,