mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 04:46:29 +03:00
Do not count mailinglist contacts as 'known'.
This commit is contained in:
@@ -1105,7 +1105,11 @@ pub fn create_by_msg_id(context: &Context, msg_id: MsgId) -> Result<ChatId, Erro
|
||||
msg_id: MsgId::new(0),
|
||||
});
|
||||
}
|
||||
Contact::scaleup_origin_by_id(context, msg.from_id, Origin::CreateChat);
|
||||
|
||||
// If the message is from a mailing list, the contacts are not counted as "known"
|
||||
if !chat.is_mailing_list() {
|
||||
Contact::scaleup_origin_by_id(context, msg.from_id, Origin::CreateChat);
|
||||
}
|
||||
Ok(chat.id)
|
||||
}
|
||||
|
||||
@@ -2526,7 +2530,6 @@ pub(crate) fn get_chat_id_by_mailinglistid(
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
/// Adds a message to device chat.
|
||||
///
|
||||
/// Optional `label` can be provided to ensure that message is added only once.
|
||||
|
||||
@@ -1785,19 +1785,22 @@ mod tests {
|
||||
|
||||
let chats = Chatlist::try_load(&t.ctx, 0, None, None).unwrap();
|
||||
assert_eq!(chats.len(), 1);
|
||||
|
||||
let chat_id = chat::create_by_msg_id(&t.ctx, chats.get_msg_id(0).unwrap()).unwrap();
|
||||
let chat = chat::Chat::load_from_db(&t.ctx, chat_id).unwrap();
|
||||
|
||||
assert!(chat.is_mailing_list());
|
||||
assert_eq!(chat.can_send(), false);
|
||||
assert_eq!(chat.name, "deltachat/deltachat-core-rust");
|
||||
assert_eq!(chat::get_chat_contacts(&t.ctx, chat_id).len(), 0);
|
||||
|
||||
|
||||
|
||||
dc_receive_imf(&t.ctx, MAILINGLIST2, "INBOX", 1, false).unwrap();
|
||||
|
||||
let chats = Chatlist::try_load(&t.ctx, 0, None, None).unwrap();
|
||||
assert_eq!(chats.len(), 1);
|
||||
assert!(Contact::get_all(&t.ctx, 0, None as Option<String>).unwrap().is_empty());
|
||||
let contacts = Contact::get_all(&t.ctx, 0, None as Option<String>).unwrap();
|
||||
assert_eq!(contacts.len(), 0); // mailing list recipients and senders do not count as "known contacts"
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -118,7 +118,7 @@ pub enum Param {
|
||||
/// For MDN-sending job
|
||||
MsgId = b'I',
|
||||
|
||||
MailingList = b't'
|
||||
MailingList = b't',
|
||||
}
|
||||
|
||||
/// Possible values for `Param::ForcePlaintext`.
|
||||
|
||||
Reference in New Issue
Block a user