treat empty membership pdf as non-existing
This commit is contained in:
parent
18047d16bf
commit
139acb2ec5
@ -989,12 +989,16 @@ pub struct UserWithRolesAndMembershipPdf {
|
||||
|
||||
impl UserWithRolesAndMembershipPdf {
|
||||
pub(crate) async fn from_user(db: &SqlitePool, user: User) -> Self {
|
||||
let membership_pdf: bool =
|
||||
sqlx::query_scalar!("SELECT membership_pdf FROM user WHERE id = ?", user.id)
|
||||
let membership_pdf =
|
||||
match sqlx::query_scalar!("SELECT membership_pdf FROM user WHERE id = ?", user.id)
|
||||
.fetch_one(db)
|
||||
.await
|
||||
.unwrap()
|
||||
.is_some();
|
||||
{
|
||||
Some(a) if a.is_empty() => false,
|
||||
None => false,
|
||||
_ => true,
|
||||
};
|
||||
|
||||
Self {
|
||||
roles: user.roles(db).await,
|
||||
|
Loading…
Reference in New Issue
Block a user