mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 21:03:46 +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;
|
return this.siteSettings.login_required && !this.currentUser;
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed
|
@discourseComputed(
|
||||||
showBootstrapModeNotice() {
|
"siteSettings.bootstrap_mode_enabled",
|
||||||
|
"router.currentRouteName"
|
||||||
|
)
|
||||||
|
showBootstrapModeNotice(bootstrapModeEnabled, currentRouteName) {
|
||||||
return (
|
return (
|
||||||
this.currentUser?.get("staff") &&
|
this.currentUser?.get("staff") &&
|
||||||
this.siteSettings.bootstrap_mode_enabled &&
|
bootstrapModeEnabled &&
|
||||||
!this.router.currentRouteName.startsWith("wizard")
|
!currentRouteName.startsWith("wizard")
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { test } from "qunit";
|
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) {
|
acceptance("Bootstrap Mode Notice", function (needs) {
|
||||||
needs.user();
|
needs.user();
|
||||||
|
@ -34,5 +35,13 @@ acceptance("Bootstrap Mode Notice", function (needs) {
|
||||||
"/wizard/steps/hello-world",
|
"/wizard/steps/hello-world",
|
||||||
"it transitions to the wizard page"
|
"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