Merge remote-tracking branch 'upstream/main' into upd
This commit is contained in:
@@ -33,13 +33,17 @@ impl<'r> FromRequest<'r> for Referer {
|
||||
}
|
||||
}
|
||||
|
||||
#[get("/user")]
|
||||
#[get("/user?<sort>&<asc>")]
|
||||
async fn index(
|
||||
db: &State<SqlitePool>,
|
||||
user: ManageUserUser,
|
||||
flash: Option<FlashMessage<'_>>,
|
||||
sort: Option<String>,
|
||||
asc: bool,
|
||||
) -> Template {
|
||||
let user_futures: Vec<_> = User::all(db)
|
||||
let sort_column = sort.unwrap_or_else(|| "last_access".to_string());
|
||||
|
||||
let user_futures: Vec<_> = User::all_with_order(db, &sort_column, asc)
|
||||
.await
|
||||
.into_iter()
|
||||
.map(|u| async move { UserWithDetails::from_user(u, db).await })
|
||||
|
@@ -38,7 +38,7 @@ async fn cal_registered(
|
||||
return Err("Invalid".into());
|
||||
};
|
||||
|
||||
if &user.user_token != uuid {
|
||||
if user.user_token != uuid {
|
||||
return Err("Invalid".into());
|
||||
}
|
||||
|
||||
|
@@ -30,6 +30,12 @@ async fn mark_read(db: &State<SqlitePool>, user: User, notification_id: i64) ->
|
||||
}
|
||||
}
|
||||
|
||||
pub fn routes() -> Vec<Route> {
|
||||
routes![mark_read]
|
||||
#[get("/read/all")]
|
||||
async fn mark_all_read(db: &State<SqlitePool>, user: User) -> Flash<Redirect> {
|
||||
Notification::mark_all_read(db, &user).await;
|
||||
Flash::success(Redirect::to("/"), "Alle Nachrichten als gelesen markiert")
|
||||
}
|
||||
|
||||
pub fn routes() -> Vec<Route> {
|
||||
routes![mark_read, mark_all_read]
|
||||
}
|
||||
|
Reference in New Issue
Block a user