diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-19 17:16:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-19 17:16:28 +0300 |
commit | e4384360a16dd9a19d4d2d25d0ef1f2b862ed2a6 (patch) | |
tree | 2fcdfa7dcdb9db8f5208b2562f4b4e803d671243 /lib/api/search.rb | |
parent | ffda4e7bcac36987f936b4ba515995a6698698f0 (diff) |
Add latest changes from gitlab-org/gitlab@16-2-stable-eev16.2.0-rc42
Diffstat (limited to 'lib/api/search.rb')
-rw-r--r-- | lib/api/search.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/api/search.rb b/lib/api/search.rb index 954c3cd9f9e..b14fce13f5e 100644 --- a/lib/api/search.rb +++ b/lib/api/search.rb @@ -59,6 +59,8 @@ module API end def search(additional_params = {}) + return Kaminari.paginate_array([]) if @project.present? && !project_scope_allowed? + search_service = search_service(additional_params) if search_service.global_search? && !search_service.global_search_enabled_for_scope? forbidden!('Global Search is disabled for this scope') @@ -95,6 +97,10 @@ module API ) end + def project_scope_allowed? + ::Search::Navigation.new(user: current_user, project: @project).tab_enabled_for_project?(params[:scope].to_sym) + end + def snippets? %w(snippet_titles).include?(params[:scope]).to_s end @@ -108,9 +114,7 @@ module API end def verify_search_scope!(resource:) - # In EE we have additional validation requirements for searches. - # Defining this method here as a noop allows us to easily extend it in - # EE, without having to modify this file directly. + # no-op end def search_type(additional_params = {}) |