mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 12:46:08 +08:00
ab053ac669
Why is this change being made? We've decided that the previous "community" section should look more like a primary section that holds the most important navigation links for the site and the word "community" doesn't quite fit that description. Therefore, we've made the decision to drop the section heading for the community section. As part of removing the section heading, the following changes are made as well: 1. Button to customize the section has been moved to the "footer" of the "More..." section when `navigation_menu` site setting is set to `sidebar`. When `navigation_menu` is set to `header dropdown`, a button to customize the section is shown inline. 2. The section will no longer be collapsable. 3. The title of the section is no longer customisable as it is no longer displayed. As a technical note, we have not dropped any previous customisations of the section's title previously in case we have to bring back the header in the future. 4. The new topic button that was previously present in the header has been removed alongside the header. Admins can add a custom section link to the `/new-topic` route if there would like to make it easier for users to create a new topic in the sidebar.
68 lines
2.0 KiB
Ruby
68 lines
2.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe "Editing Sidebar Community Section", type: :system do
|
|
fab!(:admin) { Fabricate(:admin) }
|
|
fab!(:user) { Fabricate(:user) }
|
|
|
|
let(:sidebar) { PageObjects::Components::NavigationMenu::Sidebar.new }
|
|
let(:sidebar_header_dropdown) { PageObjects::Components::NavigationMenu::HeaderDropdown.new }
|
|
|
|
it "should not display the edit section button to non admins" do
|
|
sign_in(user)
|
|
|
|
visit("/latest")
|
|
|
|
sidebar.click_community_section_more_button
|
|
|
|
expect(sidebar).to have_no_customize_community_section_button
|
|
end
|
|
|
|
it "allows admin to edit community section and reset to default" do
|
|
sign_in(admin)
|
|
|
|
visit("/latest")
|
|
|
|
expect(sidebar.primary_section_icons("community")).to eq(
|
|
%w[layer-group user flag wrench ellipsis-v],
|
|
)
|
|
|
|
modal = sidebar.click_community_section_more_button.click_customize_community_section_button
|
|
modal.fill_link("Topics", "/latest", "paper-plane")
|
|
modal.topics_link.drag_to(modal.review_link, delay: 0.4)
|
|
modal.save
|
|
|
|
expect(sidebar.primary_section_links("community")).to eq(
|
|
["My Posts", "Topics", "Review", "Admin", "More"],
|
|
)
|
|
|
|
expect(sidebar.primary_section_icons("community")).to eq(
|
|
%w[user paper-plane flag wrench ellipsis-v],
|
|
)
|
|
|
|
modal = sidebar.click_community_section_more_button.click_customize_community_section_button
|
|
modal.reset
|
|
|
|
expect(sidebar).to have_section("Community")
|
|
|
|
expect(sidebar.primary_section_links("community")).to eq(
|
|
["Topics", "My Posts", "Review", "Admin", "More"],
|
|
)
|
|
|
|
expect(sidebar.primary_section_icons("community")).to eq(
|
|
%w[layer-group user flag wrench ellipsis-v],
|
|
)
|
|
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"
|
|
|
|
sign_in(admin)
|
|
|
|
visit("/latest")
|
|
|
|
modal = sidebar_header_dropdown.open.click_customize_community_section_button
|
|
|
|
expect(modal).to be_visible
|
|
end
|
|
end
|