about summary refs log tree commit diff
path: root/app/models/follow.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-10-04 17:36:11 +0200
committerGitHub <noreply@github.com>2018-10-04 17:36:11 +0200
commita46ab86adfc9e4ea182af9a555237f17071e194c (patch)
treeed5d073badf675fdc0661c54467cc52de85c90b2 /app/models/follow.rb
parent186024a058d4b8765a10d87ff3d7f3bdcd2fbb3c (diff)
Limit the number of people that can be followed from one account (#8807)
Configurable soft limit of 7,500, and above that, configurable
ratio of 1.1 * followers, controlled by:

- MAX_FOLLOWS_THRESHOLD
- MAX_FOLLOWS_RATIO

Fix #2311
Diffstat (limited to 'app/models/follow.rb')
-rw-r--r--app/models/follow.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/follow.rb b/app/models/follow.rb
index 714f4e898..7ad56eb78 100644
--- a/app/models/follow.rb
+++ b/app/models/follow.rb
@@ -25,6 +25,7 @@ class Follow < ApplicationRecord
   has_one :notification, as: :activity, dependent: :destroy
 
   validates :account_id, uniqueness: { scope: :target_account_id }
+  validates_with FollowLimitValidator, on: :create
 
   scope :recent, -> { reorder(id: :desc) }