mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-13 23:41:00 +00:00
68c7aad179
The code is divided in three crates: - plume-common, for the ActivityPub module, and some common utils - plume-models, for the models and database-related code - plume, the app itself This new organization will allow to test it more easily, but also to create other tools that only reuse a little part of the code (for instance a Wordpress import tool, that would just use the plume-models crate)
18 lines
603 B
Rust
18 lines
603 B
Rust
use rocket::response::{Redirect, Flash};
|
|
use rocket_contrib::Template;
|
|
|
|
use plume_common::utils;
|
|
use plume_models::{db_conn::DbConn, notifications::Notification, users::User};
|
|
|
|
#[get("/notifications")]
|
|
fn notifications(conn: DbConn, user: User) -> Template {
|
|
Template::render("notifications/index", json!({
|
|
"account": user,
|
|
"notifications": Notification::find_for_user(&*conn, &user)
|
|
}))
|
|
}
|
|
|
|
#[get("/notifications", rank = 2)]
|
|
fn notifications_auth() -> Flash<Redirect>{
|
|
utils::requires_login("You need to be logged in order to see your notifications", uri!(notifications))
|
|
}
|