FIX: Do not reset sidebar defaults in wizard (#27156)

We removed the option to enable/disable the sidebar in the wizard in
https://github.com/discourse/discourse/pull/26926, but these lines of
code were resetting it quietly to `header_dropdown`.
This commit is contained in:
Penar Musaraj 2024-05-23 16:45:47 -04:00 committed by GitHub
parent 755f8de6d4
commit f9192835a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 0 additions and 16 deletions

View File

@ -94,7 +94,6 @@ class Wizard
updater.update_setting(:invite_only, updater.fields[:invite_only]) updater.update_setting(:invite_only, updater.fields[:invite_only])
updater.update_setting(:must_approve_users, updater.fields[:must_approve_users]) updater.update_setting(:must_approve_users, updater.fields[:must_approve_users])
updater.update_setting(:chat_enabled, updater.fields[:chat_enabled]) if defined?(::Chat) updater.update_setting(:chat_enabled, updater.fields[:chat_enabled]) if defined?(::Chat)
updater.update_setting(:navigation_menu, updater.fields[:enable_sidebar])
end end
end end

View File

@ -37,17 +37,6 @@ class Wizard
value = Upload.get_from_url(value) || "" value = Upload.get_from_url(value) || ""
end end
if id == :navigation_menu
value =
(
if value.to_s == "true"
NavigationMenuSiteSetting::SIDEBAR
else
NavigationMenuSiteSetting::HEADER_DROPDOWN
end
)
end
SiteSetting.set_and_log(id, value, @current_user) if SiteSetting.get(id) != value SiteSetting.set_and_log(id, value, @current_user) if SiteSetting.get(id) != value
end end

View File

@ -54,14 +54,12 @@ RSpec.describe Wizard::StepUpdater do
login_required: false, login_required: false,
invite_only: false, invite_only: false,
must_approve_users: false, must_approve_users: false,
enable_sidebar: false,
) )
updater.update updater.update
expect(updater.success?).to eq(true) expect(updater.success?).to eq(true)
expect(SiteSetting.login_required?).to eq(false) expect(SiteSetting.login_required?).to eq(false)
expect(SiteSetting.invite_only?).to eq(false) expect(SiteSetting.invite_only?).to eq(false)
expect(SiteSetting.must_approve_users?).to eq(false) expect(SiteSetting.must_approve_users?).to eq(false)
expect(SiteSetting.navigation_menu).to eq(NavigationMenuSiteSetting::HEADER_DROPDOWN)
expect(wizard.completed_steps?("privacy")).to eq(true) expect(wizard.completed_steps?("privacy")).to eq(true)
end end
@ -72,14 +70,12 @@ RSpec.describe Wizard::StepUpdater do
login_required: true, login_required: true,
invite_only: true, invite_only: true,
must_approve_users: true, must_approve_users: true,
enable_sidebar: true,
) )
updater.update updater.update
expect(updater.success?).to eq(true) expect(updater.success?).to eq(true)
expect(SiteSetting.login_required?).to eq(true) expect(SiteSetting.login_required?).to eq(true)
expect(SiteSetting.invite_only?).to eq(true) expect(SiteSetting.invite_only?).to eq(true)
expect(SiteSetting.must_approve_users?).to eq(true) expect(SiteSetting.must_approve_users?).to eq(true)
expect(SiteSetting.navigation_menu).to eq(NavigationMenuSiteSetting::SIDEBAR)
expect(wizard.completed_steps?("privacy")).to eq(true) expect(wizard.completed_steps?("privacy")).to eq(true)
end end
end end