diff options
author | Nick Schonning <nschonni@gmail.com> | 2023-02-20 00:58:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-20 06:58:28 +0100 |
commit | 717683d1c39d2fe85d1cc3f5223e1f4cf43f1900 (patch) | |
tree | adf7a7e93197707196ff3fdc7ca476deffede365 /app/validators | |
parent | d2dcb6c45a9db5439772f0553046e2c03a739a16 (diff) |
Autofix Rubocop remaining Layout rules (#23679)
Diffstat (limited to 'app/validators')
-rw-r--r-- | app/validators/follow_limit_validator.rb | 1 | ||||
-rw-r--r-- | app/validators/unreserved_username_validator.rb | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/app/validators/follow_limit_validator.rb b/app/validators/follow_limit_validator.rb index 409bf0176..c619cb9a3 100644 --- a/app/validators/follow_limit_validator.rb +++ b/app/validators/follow_limit_validator.rb @@ -6,6 +6,7 @@ class FollowLimitValidator < ActiveModel::Validator def validate(follow) return if follow.account.nil? || !follow.account.local? + follow.errors.add(:base, I18n.t('users.follow_limit_reached', limit: self.class.limit_for_account(follow.account))) if limit_reached?(follow.account) end diff --git a/app/validators/unreserved_username_validator.rb b/app/validators/unreserved_username_validator.rb index 974f3ba62..f82f4b91d 100644 --- a/app/validators/unreserved_username_validator.rb +++ b/app/validators/unreserved_username_validator.rb @@ -13,12 +13,14 @@ class UnreservedUsernameValidator < ActiveModel::Validator def pam_controlled? return false unless Devise.pam_authentication && Devise.pam_controlled_service + Rpam2.account(Devise.pam_controlled_service, @username).present? end def reserved_username? return true if pam_controlled? return false unless Setting.reserved_usernames + Setting.reserved_usernames.include?(@username.downcase) end end |