From fbabea5c7680ec6d76f6357b893bd3e0eabdfb15 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotlarek Date: Thu, 3 Aug 2023 12:53:34 +1000 Subject: [PATCH] FIX: display customised community section button when no secondary links (#22948) Edit community section button is hidden in secondary/more section. However, when there are no secondary links, then more section is not shown. In that case, we should still display an edit button for admins, so they can edit the section. --- .../sidebar/common/custom-section.hbs | 6 ++++++ .../editing_sidebar_community_section_spec.rb | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/app/assets/javascripts/discourse/app/components/sidebar/common/custom-section.hbs b/app/assets/javascripts/discourse/app/components/sidebar/common/custom-section.hbs index 30e36c03454..0e895ca41c0 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/common/custom-section.hbs +++ b/app/assets/javascripts/discourse/app/components/sidebar/common/custom-section.hbs @@ -82,5 +82,11 @@ @moreButtonIcon={{this.section.moreSectionButtonIcon}} /> {{/if}} + {{else if this.section.moreSectionButtonAction}} + {{/if}} \ No newline at end of file diff --git a/spec/system/editing_sidebar_community_section_spec.rb b/spec/system/editing_sidebar_community_section_spec.rb index 9495aec6cd8..92cc5f5ea8a 100644 --- a/spec/system/editing_sidebar_community_section_spec.rb +++ b/spec/system/editing_sidebar_community_section_spec.rb @@ -53,6 +53,23 @@ RSpec.describe "Editing Sidebar Community Section", type: :system do ) end + it "allows admin to edit community section when no secondary section links" do + SidebarSection + .where(title: "Community") + .first + .sidebar_section_links + .where.not(position: 0) + .destroy_all + + sign_in(admin) + + visit("/latest") + + modal = sidebar.click_customize_community_section_button + + expect(modal).to be_visible + end + it "should allow admins to open modal to edit the section when `navigation_menu` site setting is `header dropdown`" do SiteSetting.navigation_menu = "header dropdown"