mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +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/).
|
//! 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 deltachat_contact_tools::ContactAddress;
|
||||||
use percent_encoding::{NON_ALPHANUMERIC, utf8_percent_encode};
|
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,
|
chat.typ == Chattype::Group,
|
||||||
"Can't generate SecureJoin QR code for 1:1 chat {id}"
|
"Can't generate SecureJoin QR code for 1:1 chat {id}"
|
||||||
);
|
);
|
||||||
ensure!(
|
if chat.grpid.is_empty() {
|
||||||
!chat.grpid.is_empty(),
|
let err = format!("Can't generate QR code, chat {id} is a email thread");
|
||||||
"Can't generate SecureJoin QR code for ad-hoc group {id}"
|
error!(context, "get_securejoin_qr: {}.", err);
|
||||||
);
|
bail!(err);
|
||||||
|
}
|
||||||
Some(chat)
|
Some(chat)
|
||||||
}
|
}
|
||||||
None => None,
|
None => None,
|
||||||
|
|||||||
Reference in New Issue
Block a user