improvement: user dir search also searches in displaynames

next
timokoesters 2020-05-18 10:29:45 +02:00
parent 56dd6cb16f
commit f0aed35ecf
No known key found for this signature in database
GPG Key ID: 356E705610F626D5
2 changed files with 11 additions and 5 deletions

View File

@ -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,

View File

@ -113,7 +113,6 @@ impl AccountData {
})
{
let (kind, data) = r.unwrap();
&data.deserialize();
userdata.insert(kind, data);
}