mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 20:23:38 +08:00
FIX: show hide bootstrap mode notice in real time (#17981)
This commit is contained in:
parent
be1b202fd6
commit
a252bbf3e8
|
@ -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")
|
||||
);
|
||||
},
|
||||
|
||||
|
|
|
@ -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"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user