Skip to content

A platform for community discussion. Free, open, simple.

FIX: display customised community section button when no secondary links (#22948)

Krzysztof Kotlarekfbabea5c7680
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}}
+ <Sidebar::SectionLinkButton
+ @action={{this.section.moreSectionButtonAction}}
+ @icon={{this.section.moreSectionButtonIcon}}
+ @text={{this.section.moreSectionButtonText}}
+ />
{{/if}}
</Sidebar::Section>
\ 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"