-
- Downloads
There was an error fetching the commit references. Please try again later.
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
- app/controllers/autocomplete_controller.rb 22 additions, 50 deletionsapp/controllers/autocomplete_controller.rb
- app/finders/autocomplete/group_finder.rb 37 additions, 0 deletionsapp/finders/autocomplete/group_finder.rb
- app/finders/autocomplete/move_to_project_finder.rb 35 additions, 0 deletionsapp/finders/autocomplete/move_to_project_finder.rb
- app/finders/autocomplete/project_finder.rb 35 additions, 0 deletionsapp/finders/autocomplete/project_finder.rb
- app/finders/autocomplete/users_finder.rb 85 additions, 0 deletionsapp/finders/autocomplete/users_finder.rb
- app/finders/autocomplete_users_finder.rb 0 additions, 68 deletionsapp/finders/autocomplete_users_finder.rb
- app/finders/awarded_emoji_finder.rb 21 additions, 0 deletionsapp/finders/awarded_emoji_finder.rb
- app/finders/move_to_project_finder.rb 0 additions, 21 deletionsapp/finders/move_to_project_finder.rb
- app/finders/user_finder.rb 26 additions, 0 deletionsapp/finders/user_finder.rb
- app/models/award_emoji.rb 17 additions, 0 deletionsapp/models/award_emoji.rb
- app/models/concerns/optionally_search.rb 19 additions, 0 deletionsapp/models/concerns/optionally_search.rb
- app/models/project.rb 21 additions, 0 deletionsapp/models/project.rb
- app/models/user.rb 44 additions, 1 deletionapp/models/user.rb
- app/serializers/move_to_project_entity.rb 6 additions, 0 deletionsapp/serializers/move_to_project_entity.rb
- app/serializers/move_to_project_serializer.rb 5 additions, 0 deletionsapp/serializers/move_to_project_serializer.rb
- lib/gitlab/github_import/importer/diff_note_importer.rb 1 addition, 1 deletionlib/gitlab/github_import/importer/diff_note_importer.rb
- lib/gitlab/github_import/importer/issue_importer.rb 1 addition, 1 deletionlib/gitlab/github_import/importer/issue_importer.rb
- lib/gitlab/github_import/importer/note_importer.rb 1 addition, 1 deletionlib/gitlab/github_import/importer/note_importer.rb
- lib/gitlab/github_import/importer/pull_request_importer.rb 1 addition, 1 deletionlib/gitlab/github_import/importer/pull_request_importer.rb
- spec/controllers/autocomplete_controller_spec.rb 5 additions, 8 deletionsspec/controllers/autocomplete_controller_spec.rb
app/finders/autocomplete/group_finder.rb
0 → 100644
app/finders/autocomplete/project_finder.rb
0 → 100644
app/finders/autocomplete/users_finder.rb
0 → 100644
app/finders/awarded_emoji_finder.rb
0 → 100644
app/finders/user_finder.rb
0 → 100644
app/models/concerns/optionally_search.rb
0 → 100644
app/serializers/move_to_project_entity.rb
0 → 100644
Please register or sign in to comment