FIX: Wizard tries harder to find existing Welcome Topic

The wizard searches for:

* a topic that with the "is_welcome_topic" custom field
* a topic with the correct slug for the current default locale
* a topic with the correct slug for the English locale
* the oldest globally pinned topic

It gives up if it didn't find any of the above.
This commit is contained in:
Gerhard Schlager
2018-12-05 18:05:37 +01:00
parent 6cf2e64e44
commit 43cfdb1cb9
6 changed files with 95 additions and 15 deletions

View File

@ -48,6 +48,7 @@ class Wizard
if @wizard.completed_steps?('introduction') && !introduction.get_summary
step.disabled = true
step.description_vars = { topic_title: I18n.t("discourse_welcome_topic.title") }
else
step.add_field(id: 'welcome', type: 'textarea', required: true, value: introduction.get_summary)
@ -102,6 +103,7 @@ class Wizard
end
@wizard.append_step('corporate') do |step|
step.description_vars = { base_path: Discourse.base_path }
step.add_field(id: 'company_name', type: 'text', value: SiteSetting.company_name)
step.add_field(id: 'governing_law', type: 'text', value: SiteSetting.governing_law)
step.add_field(id: 'city_for_disputes', type: 'text', value: SiteSetting.city_for_disputes)
@ -263,6 +265,7 @@ class Wizard
@wizard.append_step('finished') do |step|
step.banner = "finished.png"
step.description_vars = { base_path: Discourse.base_path }
end
@wizard
end