diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 702fb9edcfb..1eba2d4962e 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -3266,8 +3266,8 @@ en: label: "Contact URL" placeholder: "http://www.example.com/contact-us" description: "Will be displayed on your \"About\" page." - site_contact_username: - label: "Site Contact Username" + site_contact: + label: "Site Contact" description: "All automated messages will be sent from this user." corporate: diff --git a/lib/wizard/builder.rb b/lib/wizard/builder.rb index 120d0866f09..ddd120c2ada 100644 --- a/lib/wizard/builder.rb +++ b/lib/wizard/builder.rb @@ -56,10 +56,16 @@ class Wizard @wizard.append_step('contact') do |step| step.add_field(id: 'contact_email', type: 'text', required: true, value: SiteSetting.contact_email) step.add_field(id: 'contact_url', type: 'text', value: SiteSetting.contact_url) - step.add_field(id: 'site_contact_username', type: 'text', value: SiteSetting.site_contact_username) + + username = SiteSetting.site_contact_username + username = Discourse.system_user.username if username.blank? + contact = step.add_field(id: 'site_contact', type: 'dropdown', value: username) + + User.where(admin: true).pluck(:username).each {|c| contact.add_choice(c) } step.on_update do |updater| - updater.apply_settings(:contact_email, :contact_url, :site_contact_username) + updater.apply_settings(:contact_email, :contact_url) + updater.update_setting(:site_contact_username, updater.fields[:site_contact]) end end diff --git a/spec/components/step_updater_spec.rb b/spec/components/step_updater_spec.rb index def8922823e..7d44280e9fe 100644 --- a/spec/components/step_updater_spec.rb +++ b/spec/components/step_updater_spec.rb @@ -70,7 +70,7 @@ describe Wizard::StepUpdater do updater = wizard.create_updater('contact', contact_email: 'eviltrout@example.com', contact_url: 'http://example.com/custom-contact-url', - site_contact_username: user.username) + site_contact: user.username) updater.update expect(updater).to be_success