Skip to content

Adds a User category to the autocomplete results of the search bar

Why

When searching from a Group or Project, I want to quickly see the users matching my term in the current group(s)/project.

What

I expect to see a Users category listing the first 5 users matching my search term.

  • When searching from a Group, the users have to be a group member of the group, or its ancestor group(s).
  • When searching from a Project, the users have to be a project member of the project AND a group member of the group, or its ancestor group(s). When I click on a user in the list, it takes me to the user's profile.

How

CE: Following the current autocomplete implementation, search for scoped users (for the current group/project) by doing a fuzzy database query on the search term. See how projects_autocomplete is done for an example: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/helpers/search_helper.rb#L309-321

EE: Make use of the user data in Elasticsearch to search for scoped users.

Frontend: Add a Users category to the autocomplete dropdown and display user category data.

Risk: the database query is too slow for CE users

I don't think this would be a problem because we would be limiting the search to users who are members of the current group/project.

Support needed

Design: Get approval on the suggested design. Frontend: Possibly need a frontend engineer to implement the required changes, depending on complexity.

Relates to #328565 (closed)

Release notes

Shows users matching a part of the search term under a new category in Autocomplete Suggestions. Clicking on a result opens the user's profile page.

autocomplete

Edited by Changzheng Liu