mirror of
https://github.com/discourse/discourse.git
synced 2025-03-16 16:32:15 +08: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
app/assets/javascripts/discourse
@ -17,7 +17,9 @@ export default Controller.extend({
|
|||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
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
|
@discourseComputed
|
||||||
|
@ -20,7 +20,24 @@ acceptance("Sidebar - Anonymous User", function (needs) {
|
|||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
exists(".sidebar-container"),
|
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…
x
Reference in New Issue
Block a user