diff options
Diffstat (limited to 'app/Controller/UserHelper.php')
-rw-r--r-- | app/Controller/UserHelper.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/app/Controller/UserHelper.php b/app/Controller/UserHelper.php index 041ed2c8..47bbe554 100644 --- a/app/Controller/UserHelper.php +++ b/app/Controller/UserHelper.php @@ -2,6 +2,10 @@ namespace Kanboard\Controller; +use Kanboard\Filter\UserNameFilter; +use Kanboard\Formatter\UserAutoCompleteFormatter; +use Kanboard\Model\User as UserModel; + /** * User Helper * @@ -11,19 +15,20 @@ namespace Kanboard\Controller; class UserHelper extends Base { /** - * User autocompletion (Ajax) + * User auto-completion (Ajax) * * @access public */ public function autocomplete() { $search = $this->request->getStringParam('term'); - $users = $this->userFilterAutoCompleteFormatter->create($search)->filterByUsernameOrByName()->format(); - $this->response->json($users); + $filter = $this->userQuery->withFilter(new UserNameFilter($search)); + $filter->getQuery()->asc(UserModel::TABLE.'.name')->asc(UserModel::TABLE.'.username'); + $this->response->json($filter->format(new UserAutoCompleteFormatter($this->container))); } /** - * User mention autocompletion (Ajax) + * User mention auto-completion (Ajax) * * @access public */ |