Handle errors properly

The other db-loading branches of this code handle an error, there's no
reason this bit should be skipping this.
This commit is contained in:
Floris Bruynooghe
2021-02-08 22:11:11 +01:00
parent 21e67c79a1
commit f464e43ba9

View File

@@ -682,8 +682,8 @@ impl Job {
} }
} }
// Make sure that if there now is a chat with a contact (created by an outgoing message), then group contact requests // Make sure that if there now is a chat with a contact (created by an outgoing
// from this contact should also be unblocked. // message), then group contact requests from this contact should also be unblocked.
// See https://github.com/deltachat/deltachat-core-rust/issues/2097. // See https://github.com/deltachat/deltachat-core-rust/issues/2097.
for item in chat::get_chat_msgs(context, ChatId::new(DC_CHAT_ID_DEADDROP), 0, None).await { for item in chat::get_chat_msgs(context, ChatId::new(DC_CHAT_ID_DEADDROP), 0, None).await {
if let ChatItem::Message { msg_id } = item { if let ChatItem::Message { msg_id } = item {
@@ -703,15 +703,16 @@ impl Job {
}; };
match chat.typ { match chat.typ {
Chattype::Group | Chattype::Mailinglist => { Chattype::Group | Chattype::Mailinglist => {
// The next lines are actually what we do in match chat::lookup_by_contact_id(context, msg.from_id).await {
let (_test_normal_chat_id, test_normal_chat_id_blocked) = Err(e) => {
chat::lookup_by_contact_id(context, msg.from_id) warn!(context, "can't get chat: {:#}", e);
.await return Status::RetryLater;
.unwrap_or_default(); }
Ok((_1to1_chat, Blocked::Not)) => {
if test_normal_chat_id_blocked == Blocked::Not {
chat.id.unblock(context).await; chat.id.unblock(context).await;
} }
Ok(_) => (),
}
} }
Chattype::Single | Chattype::Undefined => {} Chattype::Single | Chattype::Undefined => {}
} }