diff --git a/lib/wizard/builder.rb b/lib/wizard/builder.rb index 17a365031bc..dddf08f7a73 100644 --- a/lib/wizard/builder.rb +++ b/lib/wizard/builder.rb @@ -82,7 +82,6 @@ class Wizard username = Discourse.system_user.username if username.blank? contact = step.add_field(id: 'site_contact', type: 'dropdown', value: username) - 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 @@ -214,7 +213,7 @@ class Wizard @wizard.append_step('invites') do |step| - staff_count = User.staff.human_users.count + staff_count = User.staff.human_users.where('username_lower not in (?)', reserved_usernames).count step.add_field(id: 'staff_count', type: 'component', value: staff_count) step.add_field(id: 'invite_list', type: 'component') @@ -253,5 +252,9 @@ class Wizard raw.gsub!(old_value, new_value) end + + def reserved_usernames + @reserved_usernames ||= SiteSetting.defaults[:reserved_usernames].split('|') + end end end