From 368251347547345e888a023a09e94cc999ced327 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Wed, 27 Jul 2022 15:17:20 +0800 Subject: [PATCH] FIX: Sidebar is always disabled on wizard route (#17682) --- .../discourse/app/controllers/application.js | 12 ++++++++++-- .../discourse/tests/acceptance/sidebar-test.js | 16 ++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/app/controllers/application.js b/app/assets/javascripts/discourse/app/controllers/application.js index e2fdd32463b..bbe475a63f9 100644 --- a/app/assets/javascripts/discourse/app/controllers/application.js +++ b/app/assets/javascripts/discourse/app/controllers/application.js @@ -45,8 +45,12 @@ export default Controller.extend({ document.querySelector("body").classList.remove("sidebar-animate"); }, - @discourseComputed("enable_sidebar", "siteSettings.enable_sidebar") - sidebarEnabled(sidebarQueryParamOverride, enableSidebar) { + @discourseComputed( + "enable_sidebar", + "siteSettings.enable_sidebar", + "router.currentRouteName" + ) + sidebarEnabled(sidebarQueryParamOverride, enableSidebar, currentRouteName) { if (sidebarQueryParamOverride === "1") { return true; } @@ -55,6 +59,10 @@ export default Controller.extend({ return false; } + if (currentRouteName.startsWith("wizard")) { + return false; + } + return enableSidebar; }, diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-test.js index f7ecc13ae6b..c6cd5c39196 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-test.js @@ -134,6 +134,22 @@ acceptance( assert.notOk(exists(".sidebar-footer-link-admin")); }); + test("sidebar is disabled on wizard route", async function (assert) { + await visit("/wizard"); + + assert.notOk( + exists(".sidebar-container"), + "does not display the sidebar on wizard route" + ); + + await click(".hamburger-dropdown"); + + assert.ok( + exists(".sidebar-hamburger-dropdown"), + "navigation around the site can still be done via the sidebar hamburger" + ); + }); + test("showing and hiding sidebar", async function (assert) { await visit("/");