FIX: Unable to change homepage style via wizard (#19462)

Depending on the current state of things, sometimes the homepage style
wouldn't update because we were incorrectly blocking updates the
`desktop_category_page_style` site setting if the first item in the top
menu was 'categories'.

Added a test case to handle this situation.

See https://meta.discourse.org/t/248354
This commit is contained in:
Blake Erickson
2022-12-13 17:52:59 -07:00
committed by GitHub
parent d147e92953
commit 492f68c462
2 changed files with 22 additions and 1 deletions

View File

@ -257,6 +257,27 @@ RSpec.describe Wizard::StepUpdater do
expect(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" do
SiteSetting.top_menu = "latest|unread|unseen|categories"
updater = wizard.create_updater('styling',