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".
显示
- app/controllers/autocomplete_controller.rb 22 个添加, 52 个删除app/controllers/autocomplete_controller.rb
- app/finders/autocomplete/group_finder.rb 37 个添加, 0 个删除app/finders/autocomplete/group_finder.rb
- app/finders/autocomplete/move_to_project_finder.rb 35 个添加, 0 个删除app/finders/autocomplete/move_to_project_finder.rb
- app/finders/autocomplete/project_finder.rb 35 个添加, 0 个删除app/finders/autocomplete/project_finder.rb
- app/finders/autocomplete/users_finder.rb 87 个添加, 0 个删除app/finders/autocomplete/users_finder.rb
- app/finders/autocomplete_users_finder.rb 0 个添加, 101 个删除app/finders/autocomplete_users_finder.rb
- app/finders/awarded_emoji_finder.rb 21 个添加, 0 个删除app/finders/awarded_emoji_finder.rb
- app/finders/move_to_project_finder.rb 0 个添加, 21 个删除app/finders/move_to_project_finder.rb
- app/finders/user_finder.rb 26 个添加, 0 个删除app/finders/user_finder.rb
- app/models/award_emoji.rb 17 个添加, 0 个删除app/models/award_emoji.rb
- app/models/concerns/optionally_search.rb 19 个添加, 0 个删除app/models/concerns/optionally_search.rb
- app/models/project.rb 21 个添加, 0 个删除app/models/project.rb
- app/models/user.rb 44 个添加, 1 个删除app/models/user.rb
- app/serializers/move_to_project_entity.rb 6 个添加, 0 个删除app/serializers/move_to_project_entity.rb
- app/serializers/move_to_project_serializer.rb 5 个添加, 0 个删除app/serializers/move_to_project_serializer.rb
- ee/app/controllers/ee/autocomplete_controller.rb 13 个添加, 0 个删除ee/app/controllers/ee/autocomplete_controller.rb
- ee/app/finders/autocomplete/project_invited_groups_finder.rb 27 个添加, 0 个删除ee/app/finders/autocomplete/project_invited_groups_finder.rb
- ee/app/finders/ee/autocomplete/users_finder.rb 50 个添加, 0 个删除ee/app/finders/ee/autocomplete/users_finder.rb
- ee/app/serializers/invited_group_entity.rb 7 个添加, 0 个删除ee/app/serializers/invited_group_entity.rb
- ee/app/serializers/invited_group_serializer.rb 5 个添加, 0 个删除ee/app/serializers/invited_group_serializer.rb
加载中
想要评论请 注册 或 登录