mirror of
https://github.com/discourse/discourse.git
synced 2025-09-10 12:04:21 +08:00
DEV: simplify username suggester (#14531)
This PR doesn't change any behavior, but just removes code that wasn't in use. This is a pretty dangerous place to change, since it gets called during user's registration. At the same time the refactoring is very straightforward, it's clear that this code wasn't doing any work (it still needs to be double-checked during review though). Also, the test coverage of UserNameSuggester is good.
This commit is contained in:
parent
69f0f48dc0
commit
19d95c64af
5 changed files with 52 additions and 62 deletions
|
@ -160,14 +160,6 @@ describe UserNameSuggester do
|
|||
expect(UserNameSuggester.suggest('য়া')).to eq('য়া11')
|
||||
end
|
||||
|
||||
it "does not skip ove allowed names" do
|
||||
Fabricate(:user, username: 'sam')
|
||||
Fabricate(:user, username: 'saM1')
|
||||
Fabricate(:user, username: 'sam2')
|
||||
|
||||
expect(UserNameSuggester.suggest('SaM', 'Sam1')).to eq('Sam1')
|
||||
end
|
||||
|
||||
it "normalizes usernames" do
|
||||
actual = 'Löwe' # NFD, "Lo\u0308we"
|
||||
expected = 'Löwe' # NFC, "L\u00F6we"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue