This finder class acts more as a service, as it only returns mapped
data.
Renaming this class allows us to create a new AwardEmojiFinder without
the ambiguity of there being two similarly-named finders.
https://gitlab.com/gitlab-org/gitlab-ce/issues/63372
This refactors the AutocompleteController according to the guidelines
and boundaries discussed in
https://gitlab.com/gitlab-org/gitlab-ce/issues/49653. Specifically,
ActiveRecord logic is moved to different finders, which are then used in
the controller. View logic in turn is moved to presenters, instead of
directly using ActiveRecord's "to_json" method.
The finder MoveToProjectFinder is also adjusted according to the
abstraction guidelines and boundaries, resulting in a much more simple
finder.
By using finders (and other abstractions) more actively, we can push a
lot of logic out of the controller. We also remove the need for various
"before_action" hooks, though this could be achieved without using
finders as well.
The various finders related to AutcompleteController have also been
moved into a namespace. This removes the need for calling everything
"AutocompleteSmurfFinder", instead you can use
"Autocomplete::SmurfFinder".
In EE, `@users` can be an array at the point where we remove the current
user, because it can do a permissions check on the users for project
mirroring.
Fix this in CE by only using array methods, not AR methods. We can't use
`delete` because that uses `Object#equal?`, which isn't true in this
case.
When there was no project, no search, and no current user or author
param, the AutocompleteController would call `#uniq!` on a relation
instead of an array. This performed the less-efficient `SELECT DISTINCT`
when it wasn't even needed (because the query wouldn't return duplicates
anyway - duplicates were only added by putting a user on top of the
list).
Pass an array of user IDs in the `skip_users` param to have them
excluded from the results (unless they are explicitly included through
the `current_user` or `author_id` params).
Closes#9014
The only difference with #9014 is that I thoughed the author should also be
able to assign the issue. If this is unwanted behavior Ill revert it.