More context for chat and chatlist errors (#3932)

This commit is contained in:
Simon Laux
2023-01-07 22:36:47 +01:00
committed by iequidoo
parent ea8ee4e67d
commit bf958ce6c1
3 changed files with 19 additions and 9 deletions

View File

@@ -311,13 +311,17 @@ impl Chatlist {
};
let (lastmsg, lastcontact) = if let Some(lastmsg_id) = lastmsg_id {
let lastmsg = Message::load_from_db(context, lastmsg_id).await?;
let lastmsg = Message::load_from_db(context, lastmsg_id)
.await
.context("loading message failed")?;
if lastmsg.from_id == ContactId::SELF {
(Some(lastmsg), None)
} else {
match chat.typ {
Chattype::Group | Chattype::Broadcast | Chattype::Mailinglist => {
let lastcontact = Contact::load_from_db(context, lastmsg.from_id).await?;
let lastcontact = Contact::load_from_db(context, lastmsg.from_id)
.await
.context("loading contact failed")?;
(Some(lastmsg), Some(lastcontact))
}
Chattype::Single | Chattype::Undefined => (Some(lastmsg), None),