Skip to content

A platform for community discussion. Free, open, simple.

FIX: show hide bootstrap mode notice in real time (#17981)

Arpit Jalana252bbf3e8ac
diff --git a/app/assets/javascripts/discourse/app/controllers/application.js b/app/assets/javascripts/discourse/app/controllers/application.js
index 80c07b17b29..a6ef09a7f58 100644
--- a/app/assets/javascripts/discourse/app/controllers/application.js
+++ b/app/assets/javascripts/discourse/app/controllers/application.js
@@ -34,12 +34,15 @@ export default Controller.extend({
return this.siteSettings.login_required && !this.currentUser;
},
- @discourseComputed
- showBootstrapModeNotice() {
+ @discourseComputed(
+ "siteSettings.bootstrap_mode_enabled",
+ "router.currentRouteName"
+ )
+ showBootstrapModeNotice(bootstrapModeEnabled, currentRouteName) {
return (
this.currentUser?.get("staff") &&
- this.siteSettings.bootstrap_mode_enabled &&
- !this.router.currentRouteName.startsWith("wizard")
+ bootstrapModeEnabled &&
+ !currentRouteName.startsWith("wizard")
);
},
diff --git a/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js b/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js
index 6bbd39f7014..9d8812ccf3e 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js
@@ -1,6 +1,7 @@
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
-import { click, currentURL, visit } from "@ember/test-helpers";
+import { click, currentURL, settled, visit } from "@ember/test-helpers";
+import { set } from "@ember/object";
acceptance("Bootstrap Mode Notice", function (needs) {
needs.user();
@@ -34,5 +35,13 @@ acceptance("Bootstrap Mode Notice", function (needs) {
"/wizard/steps/hello-world",
"it transitions to the wizard page"
);
+
+ await visit("/");
+ set(this.siteSettings, "bootstrap_mode_enabled", false);
+ await settled();
+ assert.ok(
+ !exists(".bootstrap-mode-notice"),
+ "removes the notice when bootstrap mode is disabled"
+ );
});
});