Resultify get_chat_id_by_grpid and create_or_lookup_mailinglist

Use `Option` instead of `Error` to indicate that no chat ID is found.
This commit is contained in:
link2xt
2021-08-07 09:20:30 +00:00
parent ac245a6cb2
commit 5a5b80c960
7 changed files with 42 additions and 58 deletions

View File

@@ -324,11 +324,9 @@ pub async fn set_config_from_qr(context: &Context, qr: &str) -> Result<(), Error
let chat_id = if lot.state == LotState::QrReviveVerifyContact {
None
} else {
Some(
get_chat_id_by_grpid(context, &lot.text2.unwrap_or_default())
.await?
.0,
)
get_chat_id_by_grpid(context, &lot.text2.unwrap_or_default())
.await?
.map(|(chat_id, _protected, _blocked)| chat_id)
};
token::save(
context,