mirror of
https://github.com/discourse/discourse.git
synced 2025-01-04 11:40:14 +08:00
21 lines
420 B
Ruby
21 lines
420 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
module RequestTracker
|
||
|
module RateLimiters
|
||
|
class User < Base
|
||
|
def rate_limit_key
|
||
|
"user/#{@cookie[:user_id]}"
|
||
|
end
|
||
|
|
||
|
def rate_limit_globally?
|
||
|
false
|
||
|
end
|
||
|
|
||
|
def active?
|
||
|
@cookie && @cookie[:user_id] && @cookie[:trust_level] &&
|
||
|
@cookie[:trust_level] >= GlobalSetting.skip_per_ip_rate_limit_trust_level
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|