mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 03:43:39 +08:00
19672faba6
Some checks are pending
Licenses / run (push) Waiting to run
Linting / run (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, themes) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (annotations, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, themes) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, chat) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, core) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Chrome) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox ESR) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox Evergreen) (push) Waiting to run
This commit adds a new "Invite" link to the sidebar for all users who can invite to the site. Clicking the link opens the invite modal without changing the current route the user is on. Admins can customize the new link or remove it entirely if they wish by editing the sidebar section. Internal topic: t/129752.
88 lines
2.5 KiB
Ruby
88 lines
2.5 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe "Editing Sidebar Community Section", type: :system do
|
|
fab!(:admin)
|
|
fab!(: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 paper-plane ellipsis-vertical],
|
|
)
|
|
|
|
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
|
|
modal.confirm_update
|
|
|
|
expect(sidebar.primary_section_links("community")).to eq(
|
|
["My Posts", "Topics", "Review", "Admin", "Invite", "More"],
|
|
)
|
|
|
|
expect(sidebar.primary_section_icons("community")).to eq(
|
|
%w[user paper-plane flag wrench paper-plane ellipsis-vertical],
|
|
)
|
|
|
|
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", "Invite", "More"],
|
|
)
|
|
|
|
expect(sidebar.primary_section_icons("community")).to eq(
|
|
%w[layer-group user flag wrench paper-plane ellipsis-vertical],
|
|
)
|
|
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"
|
|
|
|
sign_in(admin)
|
|
|
|
visit("/latest")
|
|
|
|
sidebar_header_dropdown.open
|
|
expect(sidebar_header_dropdown).to have_dropdown_visible
|
|
modal = sidebar_header_dropdown.click_customize_community_section_button
|
|
|
|
expect(modal).to be_visible
|
|
end
|
|
end
|