FIX: staff count on invites step of wizard should only include real users

This commit is contained in:
Neil Lalonde 2017-08-14 22:17:41 -04:00
parent 6002f2ca4a
commit dd665c62f2
1 changed files with 5 additions and 2 deletions

View File

@ -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