mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 19:30:23 -06:00
FIX: hide sidebar for anonymous when login required (#18065)
Recently anonymous sidebar was introduced, but it should be hidden when site requires users to authenticate.
This commit is contained in:
parent
9ff13cee14
commit
6fb3610f4e
@ -17,7 +17,9 @@ export default Controller.extend({
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.showSidebar = !this.keyValueStore.getItem(HIDE_SIDEBAR_KEY);
|
||||
this.showSidebar =
|
||||
(this.currentUser || !this.siteSettings.login_required) &&
|
||||
!this.keyValueStore.getItem(HIDE_SIDEBAR_KEY);
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
|
@ -20,7 +20,24 @@ acceptance("Sidebar - Anonymous User", function (needs) {
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-container"),
|
||||
"sidebar exists for anonymouse user"
|
||||
"sidebar exists for anonymous user"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
acceptance("Sidebar - Anonymous User - Login Required", function (needs) {
|
||||
needs.settings({
|
||||
enable_experimental_sidebar_hamburger: true,
|
||||
enable_sidebar: true,
|
||||
login_required: true,
|
||||
});
|
||||
|
||||
test("sidebar is hidden", async function (assert) {
|
||||
await visit("/");
|
||||
|
||||
assert.ok(
|
||||
!exists(".sidebar-container"),
|
||||
"sidebar is hidden for anonymous user"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user