FEATURE: Optionally skip using full_name when suggesting usernames (#16592)

This commit introduces a new site setting: `use_name_for_username_suggestions` (default true)

Admins can disable it if they want to stop using Name values when generating usernames for users. This can be useful if you want to keep real names private-by-default or, when used in conjunction with the `use_email_for_username_and_name_suggestions` setting, you would prefer to use email-based username suggestions.
This commit is contained in:
David Taylor
2022-04-29 14:00:13 +01:00
committed by GitHub
parent 14f61c5784
commit 0f772bdf5b
6 changed files with 34 additions and 2 deletions

View File

@@ -373,7 +373,8 @@ class DiscourseConnect < DiscourseConnectBase
end
def resolve_username
suggester_input = [username, name]
suggester_input = [username]
suggester_input << name if SiteSetting.use_name_for_username_suggestions
suggester_input << email if SiteSetting.use_email_for_username_and_name_suggestions
UserNameSuggester.suggest(*suggester_input)
end