mirror of
https://github.com/flarum/core.git
synced 2025-07-21 16:51:34 +02:00
Use username helper when displaying user search results
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import highlight from 'flarum/helpers/highlight';
|
import highlight from 'flarum/helpers/highlight';
|
||||||
import avatar from 'flarum/helpers/avatar';
|
import avatar from 'flarum/helpers/avatar';
|
||||||
|
import username from 'flarum/helpers/username';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `UsersSearchSource` finds and displays user search results in the search
|
* The `UsersSearchSource` finds and displays user search results in the search
|
||||||
@@ -23,14 +24,19 @@ export default class UsersSearchResults {
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
<li className="Dropdown-header">{app.translator.trans('core.forum.search.users_heading')}</li>,
|
<li className="Dropdown-header">{app.translator.trans('core.forum.search.users_heading')}</li>,
|
||||||
results.map(user => (
|
results.map(user => {
|
||||||
|
const name = username(user);
|
||||||
|
name.children[0] = highlight(name.children[0], query);
|
||||||
|
|
||||||
|
return (
|
||||||
<li className="UserSearchResult" data-index={'users' + user.id()}>
|
<li className="UserSearchResult" data-index={'users' + user.id()}>
|
||||||
<a href={app.route.user(user)} config={m.route}>
|
<a href={app.route.user(user)} config={m.route}>
|
||||||
{avatar(user)}
|
{avatar(user)}
|
||||||
{highlight(user.username(), query)}
|
{name}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
))
|
);
|
||||||
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user