mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-22 11:31:01 +00:00
Don't use LIKE query when username is empty for user search
This commit is contained in:
parent
d6bb2bfb72
commit
213628e400
1 changed files with 7 additions and 1 deletions
|
@ -185,9 +185,15 @@ pub fn admin_search_users(
|
||||||
rockets: PlumeRocket,
|
rockets: PlumeRocket,
|
||||||
) -> Result<Ructe, ErrorPage> {
|
) -> Result<Ructe, ErrorPage> {
|
||||||
let page = page.unwrap_or_default();
|
let page = page.unwrap_or_default();
|
||||||
|
let users = if user.is_empty() {
|
||||||
|
User::get_local_page(&conn, page.limits())?
|
||||||
|
} else {
|
||||||
|
User::search_local_by_name(&conn, &user, page.limits())?
|
||||||
|
};
|
||||||
|
|
||||||
Ok(render!(instance::users(
|
Ok(render!(instance::users(
|
||||||
&(&conn, &rockets).to_context(),
|
&(&conn, &rockets).to_context(),
|
||||||
User::search_local_by_name(&conn, &user, page.limits())?,
|
users,
|
||||||
Some(user.as_str()),
|
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