diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /lib/api/search.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'lib/api/search.rb')
-rw-r--r-- | lib/api/search.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/api/search.rb b/lib/api/search.rb index fbdbe3476db..60a7e944b43 100644 --- a/lib/api/search.rb +++ b/lib/api/search.rb @@ -4,7 +4,11 @@ module API class Search < ::API::Base include PaginationParams - before { authenticate! } + before do + authenticate! + + check_rate_limit!(:user_email_lookup, scope: [current_user]) if search_service.params.email_lookup? + end feature_category :global_search @@ -36,7 +40,7 @@ module API }.freeze end - def search(additional_params = {}) + def search_service(additional_params = {}) search_params = { scope: params[:scope], search: params[:search], @@ -50,7 +54,11 @@ module API sort: params[:sort] }.merge(additional_params) - results = SearchService.new(current_user, search_params).search_objects(preload_method) + SearchService.new(current_user, search_params) + end + + def search(additional_params = {}) + results = search_service(additional_params).search_objects(preload_method) Gitlab::UsageDataCounters::SearchCounter.count(:all_searches) |