-
- Downloads
Refactor AutocompleteController
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".
parent
0a73c1c5
No related branches found
No related tags found
Showing
- spec/finders/autocomplete/group_finder_spec.rb 58 additions, 0 deletionsspec/finders/autocomplete/group_finder_spec.rb
- spec/finders/autocomplete/move_to_project_finder_spec.rb 38 additions, 26 deletionsspec/finders/autocomplete/move_to_project_finder_spec.rb
- spec/finders/autocomplete/project_finder_spec.rb 55 additions, 0 deletionsspec/finders/autocomplete/project_finder_spec.rb
- spec/finders/autocomplete/users_finder_spec.rb 1 addition, 1 deletionspec/finders/autocomplete/users_finder_spec.rb
- spec/finders/awarded_emoji_finder_spec.rb 25 additions, 0 deletionsspec/finders/awarded_emoji_finder_spec.rb
- spec/finders/user_finder_spec.rb 43 additions, 0 deletionsspec/finders/user_finder_spec.rb
- spec/models/award_emoji_spec.rb 23 additions, 0 deletionsspec/models/award_emoji_spec.rb
- spec/models/concerns/optionally_search_spec.rb 44 additions, 0 deletionsspec/models/concerns/optionally_search_spec.rb
- spec/models/project_spec.rb 47 additions, 0 deletionsspec/models/project_spec.rb
- spec/models/user_spec.rb 130 additions, 10 deletionsspec/models/user_spec.rb
- spec/serializers/move_to_project_entity_spec.rb 19 additions, 0 deletionsspec/serializers/move_to_project_entity_spec.rb
- spec/serializers/move_to_project_serializer_spec.rb 14 additions, 0 deletionsspec/serializers/move_to_project_serializer_spec.rb
spec/finders/awarded_emoji_finder_spec.rb
0 → 100644
spec/finders/user_finder_spec.rb
0 → 100644
Please register or sign in to comment