discourse/spec/models/sidebar_section_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.1 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
RSpec.describe SidebarSection do
fab!(:user) { Fabricate(: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(
DEV: Add new experimental admin UI route and sidebar (#23952) This commit adds a new admin UI under the route `/admin-revamp`, which is only accessible if the user is in a group defined by the new `enable_experimental_admin_ui_groups` site setting. It also adds a special `admin` sidebar panel that is shown instead of the `main` forum one when the admin is in this area. ![image](https://github.com/discourse/discourse/assets/920448/fa0f25e1-e178-4d94-aa5f-472fd3efd787) We also add an "Admin Revamp" sidebar link to the community section, which will only appear if the user is in the setting group: ![image](https://github.com/discourse/discourse/assets/920448/ec05ca8b-5a54-442b-ba89-6af35695c104) Within this there are subroutes defined like `/admin-revamp/config/:area`, these areas could contain any UI imaginable, this is just laying down an initial idea of the structure and how the sidebar will work. Sidebar links are currently hardcoded. Some other changes: * Changed the `main` and `chat` panels sidebar panel keys to use exported const values for reuse * Allowed custom sidebar sections to hide their headers with the `hideSectionHeader` option * Add a `groupSettingArray` setting on `this.siteSettings` in JS, which accepts a group site setting name and splits it by `|` then converts the items in the array to integers, similar to the `_map` magic for ruby group site settings * Adds a `hidden` option for sidebar panels which prevents them from showing in separated mode and prevents the switch button from being shown --------- Co-authored-by: Krzysztof Kotlarek <kotlarek.krzysztof@gmail.com>
2023-10-18 23:23:41 -05:00
[
"Topics",
"My Posts",
"Review",
"Admin",
"Admin Revamp",
"Users",
"About",
"FAQ",
"Groups",
"Badges",
],
)
end
end