Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-22 06:09:39 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-22 06:09:39 +0300
commitf8edcff7e9aff93f8ac605c19e542204b0ed9ba2 (patch)
treefe45e8bc69f5c68c6d4ee7505a4d61c4fdb70299 /lib/api/helpers.rb
parentd61d19da54b0fb8fd54df4007fa95cd39db17e57 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 0b5a471ea12..95c81c14bf9 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -695,6 +695,16 @@ module API
unprocessable_entity!('User must be authenticated to use search')
end
+ def validate_search_rate_limit!
+ return unless Feature.enabled?(:rate_limit_issuable_searches)
+
+ if current_user
+ check_rate_limit!(:search_rate_limit, scope: [current_user])
+ else
+ check_rate_limit!(:search_rate_limit_unauthenticated, scope: [ip_address])
+ end
+ end
+
private
# rubocop:disable Gitlab/ModuleWithInstanceVariables