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.
This commit is contained in:
Krzysztof Kotlarek 2023-08-03 12:53:34 +10:00 committed by GitHub
parent 135e88cb12
commit fbabea5c76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View File

@ -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>

View File

@ -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"