From 2958e093b2748aec5d968e4a9d6bcb6996e83d39 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Fri, 13 Dec 2024 17:28:08 +1000 Subject: [PATCH] FIX: Allow hot selection to actually work in wizard --- lib/wizard/builder.rb | 11 ++++++----- spec/system/wizard_spec.rb | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/wizard/builder.rb b/lib/wizard/builder.rb index 2d46514d989..4c2600aac48 100644 --- a/lib/wizard/builder.rb +++ b/lib/wizard/builder.rb @@ -191,10 +191,10 @@ class Wizard current = ( - if SiteSetting.top_menu_map.first == "categories" + if SiteSetting.homepage == "categories" SiteSetting.desktop_category_page_style else - "latest" + SiteSetting.homepage end ) style = @@ -219,9 +219,10 @@ class Wizard updater.update_setting(:heading_font, updater.fields[:heading_font]) top_menu = SiteSetting.top_menu_map - if updater.fields[:homepage_style] == "latest" && top_menu.first != "latest" - top_menu.delete("latest") - top_menu.insert(0, "latest") + if %w[latest hot].include?(updater.fields[:homepage_style]) && + top_menu.first != updater.fields[:homepage_style] + top_menu.delete(updater.fields[:homepage_style]) + top_menu.insert(0, updater.fields[:homepage_style]) elsif updater.fields[:homepage_style] != "latest" top_menu.delete("categories") top_menu.insert(0, "categories") diff --git a/spec/system/wizard_spec.rb b/spec/system/wizard_spec.rb index 73bf70afa62..6d14166eede 100644 --- a/spec/system/wizard_spec.rb +++ b/spec/system/wizard_spec.rb @@ -70,7 +70,7 @@ describe "Wizard", type: :system do wizard_page.styling_step.select_color_palette_option("Dark") wizard_page.styling_step.select_body_font_option("lato") wizard_page.styling_step.select_heading_font_option("merriweather") - wizard_page.styling_step.select_homepage_style_option("categories_only") + wizard_page.styling_step.select_homepage_style_option("hot") wizard_page.go_to_next_step expect(wizard_page).to be_on_step("ready") @@ -80,14 +80,14 @@ describe "Wizard", type: :system do ) expect(SiteSetting.base_font).to eq("lato") expect(SiteSetting.heading_font).to eq("merriweather") - expect(SiteSetting.homepage).to eq("categories") + expect(SiteSetting.homepage).to eq("hot") wizard_page.go_to_step("styling") expect(wizard_page.styling_step).to have_selected_color_palette("Dark") expect(wizard_page.styling_step).to have_selected_body_font("lato") expect(wizard_page.styling_step).to have_selected_heading_font("merriweather") - expect(wizard_page.styling_step).to have_selected_homepage_style("categories_only") + expect(wizard_page.styling_step).to have_selected_homepage_style("hot") end end