diff --git a/app/assets/javascripts/discourse/app/components/sidebar/user/categories-section.hbs b/app/assets/javascripts/discourse/app/components/sidebar/user/categories-section.hbs index a48a31c7787..269263b9656 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/user/categories-section.hbs +++ b/app/assets/javascripts/discourse/app/components/sidebar/user/categories-section.hbs @@ -1,4 +1,4 @@ -{{#if this.shouldDisplay}} +{{#if (or this.shouldDisplay this.shouldDisplayDefaultConfig)}} - {{#if (gt this.sectionLinks.length 0)}} - {{#each this.sectionLinks as |sectionLink|}} + {{#if this.shouldDisplay}} + {{#if (gt this.sectionLinks.length 0)}} + {{#each this.sectionLinks as |sectionLink|}} + + {{/each}} + {{else}} - {{/each}} - {{else}} - + {{/if}} + + {{/if}} - - - {{#if (and this.currentUser.admin (not this.hasDefaultSidebarCategories))}} + {{#if this.shouldDisplayDefaultConfig}} 0; } diff --git a/app/assets/javascripts/discourse/app/components/sidebar/user/tags-section.hbs b/app/assets/javascripts/discourse/app/components/sidebar/user/tags-section.hbs index 3bea81d2579..b09db23259e 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/user/tags-section.hbs +++ b/app/assets/javascripts/discourse/app/components/sidebar/user/tags-section.hbs @@ -1,4 +1,4 @@ -{{#if this.shouldDisplay}} +{{#if (or this.shouldDisplay this.shouldDisplayDefaultConfig)}} - {{#if (gt this.sectionLinks.length 0)}} - {{#each this.sectionLinks as |sectionLink|}} + {{#if this.shouldDisplay}} + {{#if (gt this.sectionLinks.length 0)}} + {{#each this.sectionLinks as |sectionLink|}} + + {{/each}} + {{else}} - {{/each}} - {{else}} - + {{/if}} + + {{/if}} - - - {{#if (and this.currentUser.admin (not this.hasDefaultSidebarTags))}} + {{#if this.shouldDisplayDefaultConfig}} 0; } diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js index 5e33a388f17..1fe30b9e87e 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js @@ -954,7 +954,6 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) { }); test("section link to admin site settings page when default sidebar categories have not been configured", async function (assert) { - setupUserSidebarCategories(); updateCurrentUser({ admin: true }); await visit("/"); diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.js index bd31fb664c7..cc8acf7db7e 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.js @@ -666,7 +666,11 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) { }); test("section link to admin site settings page when default sidebar tags have not been configured", async function (assert) { - updateCurrentUser({ admin: true }); + updateCurrentUser({ admin: true, sidebar_tags: [] }); + + updateCurrentUser({ + sidebar_tags: [], + }); await visit("/"); diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-sidebar-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-sidebar-test.js index 6f79b40b44f..50a8a4d84b4 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-sidebar-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-sidebar-test.js @@ -109,6 +109,7 @@ acceptance("User Preferences - Sidebar", function (needs) { }); test("user adding categories to sidebar when default sidebar categories have not been configured", async function (assert) { + updateCurrentUser({ admin: false, display_sidebar_tags: false }); await visit("/u/eviltrout/preferences/sidebar"); assert.notOk(exists(".sidebar-section[data-section-name='categories']"));