Add some feedback when performing some actions (#552)
* Add a way to display flash messages * Make the flash messages look nice * Add actual feedback messages * cargo fmt * Move flash messages to PlumeRocket And add trait to convert PlumeRocket to BaseContext * Remove useless lifetime
This commit is contained in:
@@ -2,23 +2,22 @@ use rocket::response::{Flash, Redirect};
|
||||
use rocket_i18n::I18n;
|
||||
|
||||
use plume_common::utils;
|
||||
use plume_models::{db_conn::DbConn, notifications::Notification, users::User};
|
||||
use plume_models::{notifications::Notification, users::User, PlumeRocket};
|
||||
use routes::{errors::ErrorPage, Page};
|
||||
use template_utils::Ructe;
|
||||
use template_utils::{IntoContext, Ructe};
|
||||
|
||||
#[get("/notifications?<page>")]
|
||||
pub fn notifications(
|
||||
conn: DbConn,
|
||||
user: User,
|
||||
page: Option<Page>,
|
||||
intl: I18n,
|
||||
rockets: PlumeRocket,
|
||||
) -> Result<Ructe, ErrorPage> {
|
||||
let page = page.unwrap_or_default();
|
||||
Ok(render!(notifications::index(
|
||||
&(&*conn, &intl.catalog, Some(user.clone())),
|
||||
Notification::page_for_user(&*conn, &user, page.limits())?,
|
||||
&rockets.to_context(),
|
||||
Notification::page_for_user(&*rockets.conn, &user, page.limits())?,
|
||||
page.0,
|
||||
Page::total(Notification::count_for_user(&*conn, &user)? as i32)
|
||||
Page::total(Notification::count_for_user(&*rockets.conn, &user)? as i32)
|
||||
)))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user