DEV: Avoid duplicating method attributes in `Auth::Result`.
This ensures that within the class, we have a consistent order of attributes that is passed to `UsernameSuggester`.
This commit is contained in:
parent
b584222419
commit
3fc72543de
|
@ -78,7 +78,7 @@ class Auth::Result
|
||||||
def apply_user_attributes!
|
def apply_user_attributes!
|
||||||
change_made = false
|
change_made = false
|
||||||
if SiteSetting.auth_overrides_username? && username.present? && username != user.username
|
if SiteSetting.auth_overrides_username? && username.present? && username != user.username
|
||||||
user.username = UserNameSuggester.suggest(username || name || email, user.username)
|
user.username = UserNameSuggester.suggest(username_suggester_attributes, user.username)
|
||||||
change_made = true
|
change_made = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ class Auth::Result
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
email: email,
|
email: email,
|
||||||
username: UserNameSuggester.suggest(username || name || email),
|
username: UserNameSuggester.suggest(username_suggester_attributes),
|
||||||
auth_provider: authenticator_name,
|
auth_provider: authenticator_name,
|
||||||
email_valid: !!email_valid,
|
email_valid: !!email_valid,
|
||||||
can_edit_username: can_edit_username,
|
can_edit_username: can_edit_username,
|
||||||
|
@ -155,4 +155,10 @@ class Auth::Result
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def username_suggester_attributes
|
||||||
|
username || name || email
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue