mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:29:30 +08:00
6de00f89c2
This is v0 of admin sidebar navigation, which moves all of the top-level admin nav from the top of the page into a sidebar. This is hidden behind a enable_admin_sidebar_navigation site setting, and is opt-in for now. This sidebar is dynamically shown whenever the user enters an admin route in the UI, and is hidden and replaced with either the: * Main forum sidebar * Chat sidebar Depending on where they navigate to. For now, custom sections are not supported in the admin sidebar. This commit removes the experimental admin sidebar generation rake task but keeps the experimental sidebar UI for now for further testing; it just uses the real nav as the default now.
29 lines
1.0 KiB
Ruby
29 lines
1.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe SidebarSection do
|
|
fab!(:user)
|
|
fab!(:sidebar_section) { Fabricate(:sidebar_section, user: user) }
|
|
let(:community_section) do
|
|
SidebarSection.find_by(section_type: SidebarSection.section_types[:community])
|
|
end
|
|
|
|
it "uses system user for public sections" do
|
|
expect(sidebar_section.user_id).to eq(user.id)
|
|
sidebar_section.update!(public: true)
|
|
expect(sidebar_section.user_id).to eq(Discourse.system_user.id)
|
|
end
|
|
|
|
it "resets Community section to the default state" do
|
|
community_section.update!(title: "test")
|
|
community_section.sidebar_section_links.first.linkable.update!(name: "everything edited")
|
|
community_section.sidebar_section_links.last.destroy!
|
|
community_section.reset_community!
|
|
|
|
expect(community_section.reload.title).to eq("Community")
|
|
|
|
expect(community_section.sidebar_section_links.all.map { |link| link.linkable.name }).to eq(
|
|
["Topics", "My Posts", "Review", "Admin", "Users", "About", "FAQ", "Groups", "Badges"],
|
|
)
|
|
end
|
|
end
|