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
This commit is contained in:
@ -23,6 +23,20 @@ RSpec.describe Follow, type: :model do
|
||||
follow.valid?
|
||||
expect(follow).to model_have_error_on_field(:target_account)
|
||||
end
|
||||
|
||||
it 'is invalid if account already follows too many people' do
|
||||
alice.update(following_count: FollowLimitValidator::LIMIT)
|
||||
|
||||
expect(subject).to_not be_valid
|
||||
expect(subject).to model_have_error_on_field(:base)
|
||||
end
|
||||
|
||||
it 'is valid if account is only on the brink of following too many people' do
|
||||
alice.update(following_count: FollowLimitValidator::LIMIT - 1)
|
||||
|
||||
expect(subject).to be_valid
|
||||
expect(subject).to_not model_have_error_on_field(:base)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'recent' do
|
||||
|
Reference in New Issue
Block a user