mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-22 18:23:18 +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
|
|
@ -10,8 +10,13 @@ RSpec.describe UnreservedUsernameValidator do
|
|||
attr_accessor :username
|
||||
|
||||
validates_with UnreservedUsernameValidator
|
||||
|
||||
def self.name
|
||||
'Foo'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
let(:record) { record_class.new }
|
||||
|
||||
describe '#validate' do
|
||||
|
|
@ -114,7 +119,7 @@ RSpec.describe UnreservedUsernameValidator do
|
|||
end
|
||||
|
||||
def stub_reserved_usernames(value)
|
||||
allow(Setting).to receive(:[]).with('reserved_usernames').and_return(value)
|
||||
value&.each { |str| Fabricate(:username_block, username: str, exact: true) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue