mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-23 02:33:21 +00:00
Add ability to block words in usernames (#35407)
This commit is contained in:
parent
8cf7a77808
commit
20bbd20ef1
28 changed files with 560 additions and 34 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue