mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-22 11:31:01 +00:00
Define admin_search_user route
This commit is contained in:
parent
a1a19e091a
commit
a394c3f210
1 changed files with 19 additions and 1 deletions
|
@ -160,7 +160,7 @@ pub fn toggle_block(
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/admin/users?<page>")]
|
#[get("/admin/users?<page>", rank = 2)]
|
||||||
pub fn admin_users(
|
pub fn admin_users(
|
||||||
_mod: Moderator,
|
_mod: Moderator,
|
||||||
page: Option<Page>,
|
page: Option<Page>,
|
||||||
|
@ -171,6 +171,24 @@ pub fn admin_users(
|
||||||
Ok(render!(instance::users(
|
Ok(render!(instance::users(
|
||||||
&(&conn, &rockets).to_context(),
|
&(&conn, &rockets).to_context(),
|
||||||
User::get_local_page(&conn, page.limits())?,
|
User::get_local_page(&conn, page.limits())?,
|
||||||
|
None,
|
||||||
|
page.0,
|
||||||
|
Page::total(User::count_local(&conn)? as i32)
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
#[get("/admin/users?<user>&<page>", rank = 1)]
|
||||||
|
pub fn admin_search_users(
|
||||||
|
_mod: Moderator,
|
||||||
|
user: String,
|
||||||
|
page: Option<Page>,
|
||||||
|
conn: DbConn,
|
||||||
|
rockets: PlumeRocket,
|
||||||
|
) -> Result<Ructe, ErrorPage> {
|
||||||
|
let page = page.unwrap_or_default();
|
||||||
|
Ok(render!(instance::users(
|
||||||
|
&(&conn, &rockets).to_context(),
|
||||||
|
User::search_local_by_name(&conn, &user, page.limits())?,
|
||||||
|
Some(user.as_str()),
|
||||||
page.0,
|
page.0,
|
||||||
Page::total(User::count_local(&conn)? as i32)
|
Page::total(User::count_local(&conn)? as i32)
|
||||||
)))
|
)))
|
||||||
|
|
Loading…
Reference in a new issue