diff --git a/src/chat.rs b/src/chat.rs index 2086e774f..7537e1c41 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -1957,7 +1957,7 @@ impl Chat { } /// Adds missing values to the msg object, - /// writes the record to the database and returns its msg_id. + /// writes the record to the database. /// /// If `update_msg_id` is set, that record is reused; /// if `update_msg_id` is None, a new record is created. @@ -1966,7 +1966,7 @@ impl Chat { context: &Context, msg: &mut Message, update_msg_id: Option, - ) -> Result { + ) -> Result<()> { let mut to_id = 0; let mut location_id = 0; @@ -2244,7 +2244,7 @@ impl Chat { .await?; } context.scheduler.interrupt_ephemeral_task().await; - Ok(msg.id) + Ok(()) } /// Sends a `SyncAction` synchronising chat contacts to other devices. @@ -2972,8 +2972,7 @@ async fn prepare_send_msg( if !msg.hidden { chat_id.unarchive_if_not_muted(context, msg.state).await?; } - msg.id = chat.prepare_msg_raw(context, msg, update_msg_id).await?; - msg.chat_id = chat_id; + chat.prepare_msg_raw(context, msg, update_msg_id).await?; let row_ids = create_send_msg_jobs(context, msg) .await @@ -4464,13 +4463,13 @@ pub async fn forward_msgs(context: &Context, msg_ids: &[MsgId], chat_id: ChatId) msg.state = MessageState::OutPending; msg.rfc724_mid = create_outgoing_rfc724_mid(); msg.timestamp_sort = curr_timestamp; - let new_msg_id = chat.prepare_msg_raw(context, &mut msg, None).await?; + chat.prepare_msg_raw(context, &mut msg, None).await?; curr_timestamp += 1; if !create_send_msg_jobs(context, &mut msg).await?.is_empty() { context.scheduler.interrupt_smtp().await; } - created_msgs.push(new_msg_id); + created_msgs.push(msg.id); } for msg_id in created_msgs { context.emit_msgs_changed(chat_id, msg_id);