show notification badge in menu
Some checks are pending
CI/CD Pipeline / test (push) Waiting to run
CI/CD Pipeline / deploy-staging (push) Blocked by required conditions
CI/CD Pipeline / deploy-main (push) Blocked by required conditions

This commit is contained in:
2024-04-17 13:51:47 +02:00
parent e2746d5105
commit 7c71ce59bd
17 changed files with 101 additions and 48 deletions

View File

@ -1,6 +1,6 @@
use crate::model::{
role::Role,
user::{SchnupperBetreuerUser, User, UserWithRoles},
user::{SchnupperBetreuerUser, User, UserWithRolesAndNotificationCount},
};
use futures::future::join_all;
use rocket::{
@ -38,9 +38,9 @@ async fn index(
let user_futures: Vec<_> = User::all_with_role(db, &schnupperant)
.await
.into_iter()
.map(|u| async move { UserWithRoles::from_user(u, db).await })
.map(|u| async move { UserWithRolesAndNotificationCount::from_user(u, db).await })
.collect();
let users: Vec<UserWithRoles> = join_all(user_futures).await;
let users: Vec<UserWithRolesAndNotificationCount> = join_all(user_futures).await;
let mut context = Context::new();
if let Some(msg) = flash {
@ -49,7 +49,7 @@ async fn index(
context.insert("schnupperanten", &users);
context.insert(
"loggedin_user",
&UserWithRoles::from_user(user.into(), db).await,
&UserWithRolesAndNotificationCount::from_user(user.into(), db).await,
);
Template::render("admin/schnupper/index", context.into_json())