Adding Admin > Content Manager > Spaces menu item (#16951)
This menu item will show up once you have added the `:limit_post_creation_to_admins` feature flag (regardless of whether it is enabled or not). If you wish to add the menu item: ```console rails console runner "FeatureFlag.add(:limit_post_creation_to_admins)" ``` In "adding" the item, it will default to disabled. However, as an administrator you should now be able to toggle on and off the authorization enforcement. If you wish to remove the menu item: ```console rails console runner "FeatureFlag.remove(:limit_post_creation_to_admins)" ``` Future plans for this will be to remove the `FeatureFlag.exist?` conditional so that the menu item shows up. A major consideration is that we'll assume that all Forem's have a "default space" in which folks (by default) can post. Builds on forem/forem#16897 Closes forem/forem#16842
This commit is contained in:
parent
e132279048
commit
b9b52c91a2
2 changed files with 23 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ class AdminMenu
|
|||
]
|
||||
|
||||
scope :content_manager, "dashboard-line", [
|
||||
item(name: "spaces", controller: "spaces", visible: -> { FeatureFlag.exist?(:limit_post_creation_to_admins) }),
|
||||
item(name: "posts", controller: "articles"),
|
||||
item(name: "comments", controller: "comments"),
|
||||
item(name: "badges", children: [
|
||||
|
|
|
|||
|
|
@ -45,6 +45,28 @@ RSpec.describe AdminMenu do
|
|||
it { is_expected.to be_visible }
|
||||
end
|
||||
|
||||
describe "scope :content_managers's spaces item" do
|
||||
subject(:spaces) { content_manager.children.detect { |child| child.name == "spaces" } }
|
||||
|
||||
let(:content_manager) { described_class.navigation_items.fetch(:content_manager) }
|
||||
|
||||
context "when the :limit_post_creation_to_admins does not exist" do
|
||||
it { is_expected.not_to be_visible }
|
||||
end
|
||||
|
||||
context "when the :limit_post_creation_to_admins is enabled" do
|
||||
before { FeatureFlag.enable(:limit_post_creation_to_admins) }
|
||||
|
||||
it { is_expected.to be_visible }
|
||||
end
|
||||
|
||||
context "when the :limit_post_creation_to_admins is explicitly disabled" do
|
||||
before { FeatureFlag.disable(:limit_post_creation_to_admins) }
|
||||
|
||||
it { is_expected.to be_visible }
|
||||
end
|
||||
end
|
||||
|
||||
describe "scope :customization" do
|
||||
subject(:content_manager) { described_class.navigation_items.fetch(:customization) }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue