mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 19:06:35 +03:00
fix: message::update_msg_state(): Reset error if message is delivered (#5119)
This commit is contained in:
@@ -1663,10 +1663,14 @@ pub(crate) async fn update_msg_state(
|
||||
msg_id: MsgId,
|
||||
state: MessageState,
|
||||
) -> Result<()> {
|
||||
let error_subst = match state >= MessageState::OutDelivered {
|
||||
true => ", error=''",
|
||||
false => "",
|
||||
};
|
||||
context
|
||||
.sql
|
||||
.execute(
|
||||
"UPDATE msgs SET state=?1 WHERE id=?2 AND (?1!=?3 OR state<?3)",
|
||||
&format!("UPDATE msgs SET state=?1 {error_subst} WHERE id=?2 AND (?1!=?3 OR state<?3)"),
|
||||
(state, msg_id, MessageState::OutDelivered),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user