Skip to content
代码片段 群组 项目
未验证 提交 28723ff2 编辑于 作者: Arturo Herrero's avatar Arturo Herrero 提交者: GitLab
浏览文件

Merge branch 'fix-ee-api-search-rubocop' into 'master'

No related branches found
No related tags found
无相关合并请求
...@@ -22,7 +22,6 @@ Lint/ConstantDefinitionInBlock: ...@@ -22,7 +22,6 @@ Lint/ConstantDefinitionInBlock:
- 'ee/app/models/ee/user.rb' - 'ee/app/models/ee/user.rb'
- 'ee/app/models/ee/vulnerability.rb' - 'ee/app/models/ee/vulnerability.rb'
- 'ee/app/services/ee/notes/quick_actions_service.rb' - 'ee/app/services/ee/notes/quick_actions_service.rb'
- 'ee/lib/ee/api/search.rb'
- 'ee/lib/gitlab/subscription_portal/clients/rest.rb' - 'ee/lib/gitlab/subscription_portal/clients/rest.rb'
- 'ee/lib/tasks/geo.rake' - 'ee/lib/tasks/geo.rake'
- 'ee/spec/db/schema_support.rb' - 'ee/spec/db/schema_support.rb'
......
...@@ -331,7 +331,6 @@ Style/GuardClause: ...@@ -331,7 +331,6 @@ Style/GuardClause:
- 'ee/lib/ee/api/features.rb' - 'ee/lib/ee/api/features.rb'
- 'ee/lib/ee/api/helpers/projects_helpers.rb' - 'ee/lib/ee/api/helpers/projects_helpers.rb'
- 'ee/lib/ee/api/projects.rb' - 'ee/lib/ee/api/projects.rb'
- 'ee/lib/ee/api/search.rb'
- 'ee/lib/ee/gitlab/auth/ldap/access.rb' - 'ee/lib/ee/gitlab/auth/ldap/access.rb'
- 'ee/lib/ee/gitlab/auth/ldap/sync/group.rb' - 'ee/lib/ee/gitlab/auth/ldap/sync/group.rb'
- 'ee/lib/ee/gitlab/auth/o_auth/user.rb' - 'ee/lib/ee/gitlab/auth/o_auth/user.rb'
......
...@@ -9,8 +9,6 @@ module Search ...@@ -9,8 +9,6 @@ module Search
helpers do helpers do
extend ::Gitlab::Utils::Override extend ::Gitlab::Utils::Override
ELASTICSEARCH_SCOPES = %w[wiki_blobs blobs commits notes].freeze
override :scope_preload_method override :scope_preload_method
def scope_preload_method def scope_preload_method
super.merge(blobs: :with_api_commit_entity_associations).freeze super.merge(blobs: :with_api_commit_entity_associations).freeze
...@@ -18,14 +16,18 @@ def scope_preload_method ...@@ -18,14 +16,18 @@ def scope_preload_method
override :verify_search_scope! override :verify_search_scope!
def verify_search_scope!(resource:) def verify_search_scope!(resource:)
if ELASTICSEARCH_SCOPES.include?(params[:scope]) && !use_elasticsearch?(resource) return unless elasticsearch_scope.include?(params[:scope]) && !use_elasticsearch?(resource)
render_api_error!({ error: 'Scope not supported without Elasticsearch!' }, 400)
end render_api_error!({ error: 'Scope not supported without Elasticsearch!' }, 400)
end end
def use_elasticsearch?(resource) def use_elasticsearch?(resource)
::Gitlab::CurrentSettings.search_using_elasticsearch?(scope: resource) ::Gitlab::CurrentSettings.search_using_elasticsearch?(scope: resource)
end end
def elasticsearch_scope
%w[wiki_blobs blobs commits notes].freeze
end
end end
end end
end end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册