2
0
Fork 0
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:
Andrei Prigorshnev 2021-10-27 14:41:24 +04:00 committed by GitHub
parent 69f0f48dc0
commit 19d95c64af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 62 deletions

View file

@ -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"