Use username helper when displaying user search results

This commit is contained in:
Toby Zerner 2015-12-30 15:26:54 +10:30
parent 1ae24178ff
commit f50a11b885

View File

@ -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 => {
<li className="UserSearchResult" data-index={'users' + user.id()}> const name = username(user);
<a href={app.route.user(user)} config={m.route}> name.children[0] = highlight(name.children[0], query);
{avatar(user)}
{highlight(user.username(), query)} return (
</a> <li className="UserSearchResult" data-index={'users' + user.id()}>
</li> <a href={app.route.user(user)} config={m.route}>
)) {avatar(user)}
{name}
</a>
</li>
);
})
]; ];
} }
} }