UX: setup wizard won't offer pre-existing users with reserved usernames

This commit is contained in:
Neil Lalonde 2017-08-14 15:31:57 -04:00
parent 94d8f6d734
commit 6fcb530b56
1 changed files with 4 additions and 1 deletions

View File

@ -82,7 +82,10 @@ class Wizard
username = Discourse.system_user.username if username.blank?
contact = step.add_field(id: 'site_contact', type: 'dropdown', value: username)
User.human_users.where(admin: true).pluck(:username).each { |c| contact.add_choice(c) }
reserved_usernames = SiteSetting.defaults[:reserved_usernames].split('|')
User.human_users.where(admin: true).pluck(:username).each do |c|
contact.add_choice(c) unless reserved_usernames.include?(c.downcase)
end
contact.add_choice(Discourse.system_user.username)
step.on_update do |updater|