mirror of
https://github.com/chatmail/core.git
synced 2026-04-18 22:16:30 +03:00
fix: concat ndns (#6129)
close #2338 Concat error messages when receiving new ndns. This PR adds a newline followed by the new NDN error to the error text. Maybe we should use something more prominent like ``` ----------------------------------------------------------------------- ``` or more newlines, but I'm not sure. This maybe has to be tested on a real device to see what works best.
This commit is contained in:
@@ -2240,12 +2240,22 @@ async fn handle_ndn(
|
||||
} else {
|
||||
"Delivery to at least one recipient failed.".to_string()
|
||||
};
|
||||
let err_msg = &error;
|
||||
|
||||
let mut first = true;
|
||||
for msg in msgs {
|
||||
let (msg_id, chat_id, chat_type) = msg?;
|
||||
let mut message = Message::load_from_db(context, msg_id).await?;
|
||||
set_msg_failed(context, &mut message, &error).await?;
|
||||
let aggregated_error = message
|
||||
.error
|
||||
.as_ref()
|
||||
.map(|err| format!("{}\n\n{}", err, err_msg));
|
||||
set_msg_failed(
|
||||
context,
|
||||
&mut message,
|
||||
aggregated_error.as_ref().unwrap_or(err_msg),
|
||||
)
|
||||
.await?;
|
||||
if first {
|
||||
// Add only one info msg for all failed messages
|
||||
ndn_maybe_add_info_msg(context, failed, chat_id, chat_type).await?;
|
||||
|
||||
Reference in New Issue
Block a user