fix: do not create a group if the sender includes self in the To field

This commit is contained in:
link2xt
2025-08-25 20:31:36 +00:00
committed by l
parent d0cb2110e6
commit 776408c564
2 changed files with 45 additions and 9 deletions

View File

@@ -1217,17 +1217,21 @@ async fn decide_chat_assignment(
//
// The chat may not exist yet, i.e. there may be
// no database row and ChatId yet.
let mut num_recipients = mime_parser.recipients.len();
if from_id != ContactId::SELF {
let mut has_self_addr = false;
for recipient in &mime_parser.recipients {
if context.is_self_addr(&recipient.addr).await? {
has_self_addr = true;
}
let mut num_recipients = 0;
let mut has_self_addr = false;
for recipient in &mime_parser.recipients {
if addr_cmp(&recipient.addr, &mime_parser.from.addr) {
continue;
}
if !has_self_addr {
num_recipients += 1;
if context.is_self_addr(&recipient.addr).await? {
has_self_addr = true;
}
num_recipients += 1;
}
if from_id != ContactId::SELF && !has_self_addr {
num_recipients += 1;
}
let chat_assignment = if should_trash {