mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
Make the site contact a drop down of admin users
This commit is contained in:
parent
f5a36befc6
commit
644bcbc253
3 changed files with 11 additions and 5 deletions
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue