A platform for community discussion. Free, open, simple.
FIX: Unable to change homepage style via wizard (#19462)
Blake Erickson492f68c46296
diff --git a/lib/wizard/builder.rb b/lib/wizard/builder.rbindex 9dbeb37ed25..a12dc4cafd6 100644--- a/lib/wizard/builder.rb+++ b/lib/wizard/builder.rb@@ -166,7 +166,7 @@ class Wizardif updater.fields[:homepage_style] == 'latest' && top_menu[0] != "latest"top_menu.delete("latest")top_menu.insert(0, "latest")- elsif updater.fields[:homepage_style] != 'latest' && top_menu[0] != "categories"+ elsif updater.fields[:homepage_style] != 'latest'top_menu.delete("categories")top_menu.insert(0, "categories")updater.update_setting(:desktop_category_page_style, updater.fields[:homepage_style])diff --git a/spec/lib/wizard/step_updater_spec.rb b/spec/lib/wizard/step_updater_spec.rbindex 9dc65a98c7c..c6670b864a8 100644--- a/spec/lib/wizard/step_updater_spec.rb+++ b/spec/lib/wizard/step_updater_spec.rb@@ -257,6 +257,27 @@ RSpec.describe Wizard::StepUpdater doexpect(SiteSetting.top_menu).to eq('latest|categories|new|top')end+ it "updates style even when categories is first in top menu" do+ SiteSetting.top_menu = "categories|new|latest"+ updater = wizard.create_updater('styling',+ body_font: 'arial',+ heading_font: 'arial',+ homepage_style: "categories_with_featured_topics"+ )+ updater.update+ expect(updater).to be_success+ expect(SiteSetting.desktop_category_page_style).to eq('categories_with_featured_topics')++ updater = wizard.create_updater('styling',+ body_font: 'arial',+ heading_font: 'arial',+ homepage_style: "subcategories_with_featured_topics"+ )+ updater.update+ expect(updater).to be_success+ expect(SiteSetting.desktop_category_page_style).to eq('subcategories_with_featured_topics')+ end+it "does not overwrite top_menu site setting" doSiteSetting.top_menu = "latest|unread|unseen|categories"updater = wizard.create_updater('styling',