mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 17:02:45 +08:00
FIX: Sidebar hamburger panel dropdown not working for anonymous (#18085)
We were incorrectly trying to render the sidebar sections for a logged in user.
This commit is contained in:
parent
0b5a0fd857
commit
e9dac86cc0
|
@ -1,9 +1,4 @@
|
|||
<DSection @pageClass="has-sidebar" @class="sidebar-container" @scrollTop={{false}}>
|
||||
{{#if this.currentUser}}
|
||||
<Sidebar::User::Sections @collapsableSections={{true}}/>
|
||||
{{else}}
|
||||
<Sidebar::Anonymous::Sections @collapsableSections={{true}}/>
|
||||
{{/if}}
|
||||
|
||||
<Sidebar::Sections @currentUser={{this.currentUser}} @collapsableSections={{true}} />
|
||||
<Sidebar::Footer />
|
||||
</DSection>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="panel-body">
|
||||
<div class="panel-body-contents">
|
||||
<div class="sidebar-hamburger-dropdown">
|
||||
<Sidebar::User::Sections @collapsableSections={{false}}/>
|
||||
<Sidebar::Sections @currentUser={{this.currentUser}} @collapsableSections={{false}} />
|
||||
<Sidebar::Footer @tagName="" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -4,6 +4,7 @@ import { inject as service } from "@ember/service";
|
|||
|
||||
export default class SidebarHamburgerDropdown extends Component {
|
||||
@service appEvents;
|
||||
@service currentUser;
|
||||
|
||||
@action
|
||||
triggerRenderedAppEvent() {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{{#if @currentUser}}
|
||||
<Sidebar::User::Sections @collapsableSections={{@collapsableSections}}/>
|
||||
{{else}}
|
||||
<Sidebar::Anonymous::Sections @collapsableSections={{@collapsableSections}}/>
|
||||
{{/if}}
|
|
@ -0,0 +1,3 @@
|
|||
import templateOnly from "@ember/component/template-only";
|
||||
|
||||
export default templateOnly();
|
|
@ -1,6 +1,6 @@
|
|||
import { test } from "qunit";
|
||||
|
||||
import { visit } from "@ember/test-helpers";
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
|
||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -28,6 +28,18 @@ acceptance("Sidebar - Anonymous User", function (needs) {
|
|||
"toggle button for anonymous user"
|
||||
);
|
||||
});
|
||||
|
||||
test("sidebar hamburger panel dropdown when sidebar has been disabled", async function (assert) {
|
||||
this.siteSettings.enable_sidebar = false;
|
||||
|
||||
await visit("/");
|
||||
await click(".hamburger-dropdown");
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-hamburger-dropdown .sidebar-sections-anonymous"),
|
||||
"sidebar hamburger panel dropdown renders anonymous sidebar sections"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
acceptance("Sidebar - Anonymous User - Login Required", function (needs) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user