improvement: user dir search also searches in displaynames
This commit is contained in:
parent
56dd6cb16f
commit
f0aed35ecf
2 changed files with 11 additions and 5 deletions
|
@ -1205,11 +1205,18 @@ pub fn search_users_route(
|
|||
.users
|
||||
.iter()
|
||||
.map(Result::unwrap)
|
||||
.filter(|user_id| user_id.to_string().contains(&body.search_term))
|
||||
.map(|user_id| search_users::User {
|
||||
user_id,
|
||||
display_name: None,
|
||||
avatar_url: None,
|
||||
user_id: user_id.clone(),
|
||||
display_name: db.users.displayname(&user_id).unwrap(),
|
||||
avatar_url: db.users.avatar_url(&user_id).unwrap(),
|
||||
})
|
||||
.filter(|user| {
|
||||
user.user_id.to_string().contains(&body.search_term)
|
||||
|| user
|
||||
.display_name
|
||||
.as_ref()
|
||||
.filter(|name| name.contains(&body.search_term))
|
||||
.is_some()
|
||||
})
|
||||
.collect(),
|
||||
limited: false,
|
||||
|
|
|
@ -113,7 +113,6 @@ impl AccountData {
|
|||
})
|
||||
{
|
||||
let (kind, data) = r.unwrap();
|
||||
&data.deserialize();
|
||||
userdata.insert(kind, data);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue