DEV: show admin moderation flags UI (#28071)
The page was hidden behind a feature flag in this PR https://github.com/discourse/discourse/pull/27756 It is now in a shippable state.
This commit is contained in:
parent
31d3984e50
commit
205a2bf0d6
|
@ -103,6 +103,12 @@ export const ADMIN_NAV_MAP = [
|
||||||
label: "admin.community.sidebar_link.legal",
|
label: "admin.community.sidebar_link.legal",
|
||||||
icon: "gavel",
|
icon: "gavel",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "admin_moderation_flags",
|
||||||
|
route: "adminConfig.flags",
|
||||||
|
label: "admin.community.sidebar_link.moderation_flags",
|
||||||
|
icon: "flag",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -325,17 +325,6 @@ export default class AdminSidebarPanel extends BaseCustomSidebarPanel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentUser.show_experimental_flags_admin_page) {
|
|
||||||
navMap
|
|
||||||
.find((section) => section.name === "community")
|
|
||||||
.links.push({
|
|
||||||
name: "admin_moderation_flags",
|
|
||||||
route: "adminConfig.flags",
|
|
||||||
label: "admin.community.sidebar_link.moderation_flags",
|
|
||||||
icon: "flag",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
navMap.forEach((section) =>
|
navMap.forEach((section) =>
|
||||||
section.links.forEach((link) => {
|
section.links.forEach((link) => {
|
||||||
if (link.keywords) {
|
if (link.keywords) {
|
||||||
|
|
|
@ -76,7 +76,6 @@ class CurrentUserSerializer < BasicUserSerializer
|
||||||
:can_view_raw_email,
|
:can_view_raw_email,
|
||||||
:use_glimmer_topic_list?,
|
:use_glimmer_topic_list?,
|
||||||
:login_method,
|
:login_method,
|
||||||
:show_experimental_flags_admin_page,
|
|
||||||
:render_experimental_about_page
|
:render_experimental_about_page
|
||||||
|
|
||||||
delegate :user_stat, to: :object, private: true
|
delegate :user_stat, to: :object, private: true
|
||||||
|
@ -142,18 +141,10 @@ class CurrentUserSerializer < BasicUserSerializer
|
||||||
object.staff?
|
object.staff?
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_experimental_flags_admin_page
|
|
||||||
object.in_any_groups?(SiteSetting.experimental_flags_admin_page_enabled_groups_map)
|
|
||||||
end
|
|
||||||
|
|
||||||
def render_experimental_about_page
|
def render_experimental_about_page
|
||||||
object.in_any_groups?(SiteSetting.experimental_redesigned_about_page_groups_map)
|
object.in_any_groups?(SiteSetting.experimental_redesigned_about_page_groups_map)
|
||||||
end
|
end
|
||||||
|
|
||||||
def include_show_experimental_flags_admin_page?
|
|
||||||
object.admin?
|
|
||||||
end
|
|
||||||
|
|
||||||
def can_post_anonymously
|
def can_post_anonymously
|
||||||
SiteSetting.allow_anonymous_posting &&
|
SiteSetting.allow_anonymous_posting &&
|
||||||
(is_anonymous || object.in_any_groups?(SiteSetting.anonymous_posting_allowed_groups_map))
|
(is_anonymous || object.in_any_groups?(SiteSetting.anonymous_posting_allowed_groups_map))
|
||||||
|
|
|
@ -2428,12 +2428,6 @@ developer:
|
||||||
default: ""
|
default: ""
|
||||||
client: true
|
client: true
|
||||||
hidden: true
|
hidden: true
|
||||||
experimental_flags_admin_page_enabled_groups:
|
|
||||||
default: ""
|
|
||||||
type: group_list
|
|
||||||
list_type: compact
|
|
||||||
allow_any: false
|
|
||||||
refresh: true
|
|
||||||
experimental_redesigned_about_page_groups:
|
experimental_redesigned_about_page_groups:
|
||||||
default: ""
|
default: ""
|
||||||
type: group_list
|
type: group_list
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class RemoveExperimentalFlagsAdminPageSiteSetting < ActiveRecord::Migration[7.1]
|
||||||
|
def up
|
||||||
|
execute "DELETE FROM site_settings WHERE name = 'experimental_flags_admin_page_enabled_groups'"
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
raise ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
|
end
|
|
@ -8,7 +8,6 @@ describe "Admin Flags Page", type: :system do
|
||||||
let(:topic_page) { PageObjects::Pages::Topic.new }
|
let(:topic_page) { PageObjects::Pages::Topic.new }
|
||||||
let(:admin_flags_page) { PageObjects::Pages::AdminFlags.new }
|
let(:admin_flags_page) { PageObjects::Pages::AdminFlags.new }
|
||||||
let(:admin_flag_form_page) { PageObjects::Pages::AdminFlagForm.new }
|
let(:admin_flag_form_page) { PageObjects::Pages::AdminFlagForm.new }
|
||||||
let(:sidebar) { PageObjects::Components::NavigationMenu::Sidebar.new }
|
|
||||||
|
|
||||||
before { sign_in(admin) }
|
before { sign_in(admin) }
|
||||||
|
|
||||||
|
@ -162,17 +161,4 @@ describe "Admin Flags Page", type: :system do
|
||||||
admin_flags_page.open_flag_menu("off_topic")
|
admin_flags_page.open_flag_menu("off_topic")
|
||||||
expect(page).not_to have_css(".dropdown-menu__item .move-up")
|
expect(page).not_to have_css(".dropdown-menu__item .move-up")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not show the moderation flags link in the sidebar by default" do
|
|
||||||
visit "/admin"
|
|
||||||
sidebar.toggle_all_sections
|
|
||||||
expect(sidebar).to have_no_section_link(
|
|
||||||
I18n.t("admin_js.admin.community.sidebar_link.moderation_flags"),
|
|
||||||
)
|
|
||||||
SiteSetting.experimental_flags_admin_page_enabled_groups = Group::AUTO_GROUPS[:admins]
|
|
||||||
visit "/admin"
|
|
||||||
expect(sidebar).to have_section_link(
|
|
||||||
I18n.t("admin_js.admin.community.sidebar_link.moderation_flags"),
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue