FIX: Multiply ratelimiter leniency for own discobot certs (#13639)

This commit is contained in:
Kane York 2021-07-05 17:23:57 -07:00 committed by GitHub
parent cf63931b9e
commit 38332cae21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -97,7 +97,11 @@ after_initialize do
raise Discourse::InvalidParameters.new("#{key} must be present") unless params[key]&.present?
end
if params[:user_id].to_i != current_user.id
rate_limiter = RateLimiter.new(current_user, 'svg_certificate', 3, 1.minute)
else
rate_limiter = RateLimiter.new(current_user, 'svg_certificate_self', 30, 10.minutes)
end
rate_limiter.performed! unless current_user.staff?
user = User.find_by(id: params[:user_id])