2
0

Add ability to block words in usernames (#35407)

This commit is contained in:
Eugen Rochko
2025-07-29 12:19:15 +02:00
committed by GitHub
parent 8cf7a77808
commit 20bbd20ef1
28 changed files with 560 additions and 34 deletions

View File

@@ -28,14 +28,6 @@ class UnreservedUsernameValidator < ActiveModel::Validator
end
def settings_username_reserved?
settings_has_reserved_usernames? && settings_reserves_username?
end
def settings_has_reserved_usernames?
Setting.reserved_usernames.present?
end
def settings_reserves_username?
Setting.reserved_usernames.include?(@username.downcase)
UsernameBlock.matches?(@username, allow_with_approval: false)
end
end