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 248a672f791..0086cdd58ed 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 @@ -27,5 +27,16 @@ {{/if}} + + {{#if (and this.currentUser.admin (not this.hasDefaultSidebarTags))}} + + {{/if}} {{/if}} diff --git a/app/assets/javascripts/discourse/app/components/sidebar/user/tags-section.js b/app/assets/javascripts/discourse/app/components/sidebar/user/tags-section.js index 94e8a64b155..fcb60d9de55 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/user/tags-section.js +++ b/app/assets/javascripts/discourse/app/components/sidebar/user/tags-section.js @@ -71,13 +71,17 @@ export default class SidebarUserTagsSection extends Component { * If a site has default sidebar tags configured, always display the tags section. */ get shouldDisplay() { - if (this.siteSettings.default_sidebar_tags.length > 0) { + if (this.hasDefaultSidebarTags) { return true; } else { return this.currentUser.sidebarTags.length > 0; } } + get hasDefaultSidebarTags() { + return this.siteSettings.default_sidebar_tags.length > 0; + } + @action editTracked() { this.router.transitionTo("preferences.sidebar", this.currentUser); 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 707b11f80a4..f3041590d8e 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 @@ -59,6 +59,7 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) { }, ], display_sidebar_tags: true, + admin: false, }); needs.pretender((server, helper) => { @@ -423,4 +424,23 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) { initialCallbackCount ); }); + + test("section link to admin site settings page when default sidebar tags have not been configured", async function (assert) { + updateCurrentUser({ admin: true }); + + await visit("/"); + + assert.ok( + exists(".sidebar-section-link-configure-default-sidebar-tags"), + "section link to configure default sidebar tags is shown" + ); + + await click(".sidebar-section-link-configure-default-sidebar-tags"); + + assert.strictEqual( + currentURL(), + "/admin/site_settings/category/all_results?filter=default_sidebar_tags", + "it links to the admin site settings page correctly" + ); + }); }); diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 8b5311771f2..8b97e26c1d1 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1177,7 +1177,7 @@ en: enable_quoting: "Enable quote reply for highlighted text" enable_defer: "Enable defer to mark topics unread" experimental_sidebar: - enable: "Enable experimental sidebar" + enable: "Enable sidebar" options: "Options" categories_section: "Categories Section" categories_section_instruction: "Selected categories will be displayed under Sidebar's categories section." @@ -4189,6 +4189,7 @@ en: click_to_get_started: "Click here to get started." header_link_text: "Tags" header_action_title: "edit your sidebar tags" + configure_defaults: "Configure defaults" categories: none: "You have not added any categories." click_to_get_started: "Click here to get started." @@ -5666,6 +5667,7 @@ en: search: "Search" groups: "Groups" dashboard: "Dashboard" + sidebar: "Sidebar" secret_list: invalid_input: "Input fields cannot be empty or contain vertical bar character." default_categories: