mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 00:46:30 +03:00
feat: get_securejoin_qr(): Log error if group doesn't have grpid
This doesn't fix anything in UIs currently because they don't call `get_securejoin_qr()` for unencrypted groups, but it's still better to log an error which will be shown in this case.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//! Implementation of [SecureJoin protocols](https://securejoin.delta.chat/).
|
||||
|
||||
use anyhow::{Context as _, Error, Result, ensure};
|
||||
use anyhow::{Context as _, Error, Result, bail, ensure};
|
||||
use deltachat_contact_tools::ContactAddress;
|
||||
use percent_encoding::{NON_ALPHANUMERIC, utf8_percent_encode};
|
||||
|
||||
@@ -63,10 +63,11 @@ pub async fn get_securejoin_qr(context: &Context, group: Option<ChatId>) -> Resu
|
||||
chat.typ == Chattype::Group,
|
||||
"Can't generate SecureJoin QR code for 1:1 chat {id}"
|
||||
);
|
||||
ensure!(
|
||||
!chat.grpid.is_empty(),
|
||||
"Can't generate SecureJoin QR code for ad-hoc group {id}"
|
||||
);
|
||||
if chat.grpid.is_empty() {
|
||||
let err = format!("Can't generate QR code, chat {id} is a email thread");
|
||||
error!(context, "get_securejoin_qr: {}.", err);
|
||||
bail!(err);
|
||||
}
|
||||
Some(chat)
|
||||
}
|
||||
None => None,
|
||||
|
||||
Reference in New Issue
Block a user