Fix: 絵文字リアクションに厳しいレートリミットが適用される問題 (#752)

This commit is contained in:
KMY(雪あすか) 2024-06-02 13:53:58 +09:00 committed by GitHub
parent 14820ee52d
commit 51155d6bd8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 70 additions and 17 deletions

View file

@ -141,8 +141,10 @@ class Rack::Attack
req.session[:attempt_user_id] || req.params.dig('user', 'email').presence if req.post? && req.path_matches?('/auth/sign_in')
end
API_CREATE_EMOJI_REACTION_REGEX = %r{\A/api/v1/statuses/\d+/emoji_reactions}
throttle('throttle_password_change/account', limit: 10, period: 10.minutes) do |req|
req.warden_user_id if req.put? || (req.patch? && req.path_matches?('/auth'))
req.warden_user_id if (req.put? && !req.path.match?(API_CREATE_EMOJI_REACTION_REGEX)) || (req.patch? && req.path_matches?('/auth'))
end
self.throttled_responder = lambda do |request|