Merge pull request 'treat empty membership pdf as non-existing' (#456) from treat-empty-membershippdf-as-nonexisting into staging
Reviewed-on: #456
This commit is contained in:
commit
79976b751f
@ -989,12 +989,16 @@ pub struct UserWithRolesAndMembershipPdf {
|
|||||||
|
|
||||||
impl UserWithRolesAndMembershipPdf {
|
impl UserWithRolesAndMembershipPdf {
|
||||||
pub(crate) async fn from_user(db: &SqlitePool, user: User) -> Self {
|
pub(crate) async fn from_user(db: &SqlitePool, user: User) -> Self {
|
||||||
let membership_pdf: bool =
|
let membership_pdf =
|
||||||
sqlx::query_scalar!("SELECT membership_pdf FROM user WHERE id = ?", user.id)
|
match sqlx::query_scalar!("SELECT membership_pdf FROM user WHERE id = ?", user.id)
|
||||||
.fetch_one(db)
|
.fetch_one(db)
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.is_some();
|
{
|
||||||
|
Some(a) if a.is_empty() => false,
|
||||||
|
None => false,
|
||||||
|
_ => true,
|
||||||
|
};
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
roles: user.roles(db).await,
|
roles: user.roles(db).await,
|
||||||
|
Loading…
Reference in New Issue
Block a user