Don't use LIKE query when username is empty for user search
This commit is contained in:
parent
d6bb2bfb72
commit
213628e400
@ -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 New Issue
Block a user