fix: Reset message error when scheduling resending (#5119)

Before, while a message is in OutPending state after resending is requested, the user still sees the
red marker with error and it is confusing, so the user don't know the sending state of the message.
This commit is contained in:
iequidoo
2024-01-06 21:59:17 -03:00
committed by iequidoo
parent ff54cf24a1
commit c8075e53d2
2 changed files with 5 additions and 1 deletions

View File

@@ -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 => "",
};

View File

@@ -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,