diff --git a/app/lib/rate_limiter.rb b/app/lib/rate_limiter.rb index 4a0b35b081..ff105443e8 100644 --- a/app/lib/rate_limiter.rb +++ b/app/lib/rate_limiter.rb @@ -14,6 +14,11 @@ class RateLimiter period: 3.hours.freeze, }.freeze, + emoji_reactions: { + limit: 300, + period: 3.hours.freeze, + }.freeze, + reports: { limit: 400, period: 24.hours.freeze, diff --git a/app/models/emoji_reaction.rb b/app/models/emoji_reaction.rb index 2534cfebe2..50da1a083f 100644 --- a/app/models/emoji_reaction.rb +++ b/app/models/emoji_reaction.rb @@ -16,11 +16,14 @@ class EmojiReaction < ApplicationRecord include Paginable + include RateLimitable EMOJI_REACTION_LIMIT = 32_767 EMOJI_REACTION_PER_ACCOUNT_LIMIT = ENV.fetch('EMOJI_REACTION_PER_ACCOUNT_LIMIT', 3).to_i EMOJI_REACTION_PER_REMOTE_ACCOUNT_LIMIT = ENV.fetch('EMOJI_REACTION_PER_REMOTE_ACCOUNT_LIMIT', 3).to_i + rate_limit by: :account, family: :emoji_reactions + update_index('statuses', :status) scope :local, -> { where(uri: nil) }