mirror of
https://github.com/chatmail/core.git
synced 2026-05-15 12:56:30 +03:00
fix: prioritize mailing list over self-sent messages
New Delta Chat is going to send self-sent messages with undisclosed recipients instead of placing self into the `To` field. To avoid assigning broadcast list messages to Saved Messages chat, we should check the mailing list headers before attempting to assign to Saved Messages.
This commit is contained in:
@@ -1181,6 +1181,22 @@ async fn add_parts(
|
|||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if chat_id.is_none() {
|
||||||
|
// Check if the message belongs to a broadcast list.
|
||||||
|
if let Some(mailinglist_header) = mime_parser.get_mailinglist_header() {
|
||||||
|
let listid = mailinglist_header_listid(mailinglist_header)?;
|
||||||
|
chat_id = Some(
|
||||||
|
if let Some((id, ..)) = chat::get_chat_id_by_grpid(context, &listid).await? {
|
||||||
|
id
|
||||||
|
} else {
|
||||||
|
let name =
|
||||||
|
compute_mailinglist_name(mailinglist_header, &listid, mime_parser);
|
||||||
|
chat::create_broadcast_list_ex(context, Nosync, listid, name).await?
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if chat_id.is_none() && self_sent {
|
if chat_id.is_none() && self_sent {
|
||||||
// from_id==to_id==ContactId::SELF - this is a self-sent messages,
|
// from_id==to_id==ContactId::SELF - this is a self-sent messages,
|
||||||
// maybe an Autocrypt Setup Message
|
// maybe an Autocrypt Setup Message
|
||||||
@@ -1200,22 +1216,6 @@ async fn add_parts(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if chat_id.is_none() {
|
|
||||||
// Check if the message belongs to a broadcast list.
|
|
||||||
if let Some(mailinglist_header) = mime_parser.get_mailinglist_header() {
|
|
||||||
let listid = mailinglist_header_listid(mailinglist_header)?;
|
|
||||||
chat_id = Some(
|
|
||||||
if let Some((id, ..)) = chat::get_chat_id_by_grpid(context, &listid).await? {
|
|
||||||
id
|
|
||||||
} else {
|
|
||||||
let name =
|
|
||||||
compute_mailinglist_name(mailinglist_header, &listid, mime_parser);
|
|
||||||
chat::create_broadcast_list_ex(context, Nosync, listid, name).await?
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if fetching_existing_messages && mime_parser.decrypting_failed {
|
if fetching_existing_messages && mime_parser.decrypting_failed {
|
||||||
|
|||||||
Reference in New Issue
Block a user