mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 23:36:30 +03:00
Merge pull request #1354 from deltachat/fix-bcc-self-group-crash
fix crash in self-only-groups with bcc_self enabled
This commit is contained in:
@@ -76,6 +76,20 @@ class TestOfflineAccountBasic:
|
|||||||
with pytest.raises(KeyError):
|
with pytest.raises(KeyError):
|
||||||
ac1.get_config("123123")
|
ac1.get_config("123123")
|
||||||
|
|
||||||
|
def test_empty_group_bcc_self_enabled(self, acfactory):
|
||||||
|
ac1 = acfactory.get_configured_offline_account()
|
||||||
|
ac1.set_config("bcc_self", "1")
|
||||||
|
chat = ac1.create_group_chat(name="group1")
|
||||||
|
msg = chat.send_text("msg1")
|
||||||
|
assert msg in chat.get_messages()
|
||||||
|
|
||||||
|
def test_empty_group_bcc_self_disabled(self, acfactory):
|
||||||
|
ac1 = acfactory.get_configured_offline_account()
|
||||||
|
ac1.set_config("bcc_self", "0")
|
||||||
|
chat = ac1.create_group_chat(name="group1")
|
||||||
|
msg = chat.send_text("msg1")
|
||||||
|
assert msg in chat.get_messages()
|
||||||
|
|
||||||
|
|
||||||
class TestOfflineContact:
|
class TestOfflineContact:
|
||||||
def test_contact_attr(self, acfactory):
|
def test_contact_attr(self, acfactory):
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
self.from_addr.clone(),
|
self.from_addr.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut to = Vec::with_capacity(self.recipients.len());
|
let mut to = Vec::new();
|
||||||
for (name, addr) in self.recipients.iter() {
|
for (name, addr) in self.recipients.iter() {
|
||||||
if name.is_empty() {
|
if name.is_empty() {
|
||||||
to.push(Address::new_mailbox(addr.clone()));
|
to.push(Address::new_mailbox(addr.clone()));
|
||||||
@@ -380,6 +380,10 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if to.is_empty() {
|
||||||
|
to.push(from.clone());
|
||||||
|
}
|
||||||
|
|
||||||
if !self.references.is_empty() {
|
if !self.references.is_empty() {
|
||||||
unprotected_headers.push(Header::new("References".into(), self.references.clone()));
|
unprotected_headers.push(Header::new("References".into(), self.references.clone()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user