]> cat aescling's git repositories - mastodon.git/commitdiff
Fix follow limit validator reporting lower number past threshold (#9230)
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 8 Nov 2018 20:06:01 +0000 (21:06 +0100)
committerGitHub <noreply@github.com>
Thu, 8 Nov 2018 20:06:01 +0000 (21:06 +0100)
* Fix follow limit validator reporting lower number past threshold

* Avoid floating point follow limit

app/validators/follow_limit_validator.rb

index eb083ed854b74a47cd3aa05c58720775d5a0e553..409bf01763b45e89840f7b1bb386861b162683ad 100644 (file)
@@ -14,7 +14,7 @@ class FollowLimitValidator < ActiveModel::Validator
       if account.following_count < LIMIT
         LIMIT
       else
-        account.followers_count * RATIO
+        [(account.followers_count * RATIO).round, LIMIT].max
       end
     end
   end