mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +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:

committed by
GitHub

parent
69f0f48dc0
commit
19d95c64af
@ -77,8 +77,8 @@ class Auth::Result
|
||||
|
||||
def apply_user_attributes!
|
||||
change_made = false
|
||||
if SiteSetting.auth_overrides_username? && username.present? && username != user.username
|
||||
user.username = UserNameSuggester.suggest(username_suggester_attributes, user.username)
|
||||
if SiteSetting.auth_overrides_username? && username.present? && UserNameSuggester.fix_username(username) != user.username
|
||||
user.username = UserNameSuggester.suggest(username)
|
||||
change_made = true
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user