DEV: Hide admin Moderation Flags UI behind feature flag for now (#27756)

Adds experimental_flags_admin_page_enabled_groups (default "")
to remove the Moderation Flags link from the admin sidebar for now,
there are still a few bugfixes that need to be done before we
are comfortable with turning this on more widely. This is
a _temporary_ flag, we will be removing this once the feature
is more stable.
This commit is contained in:
Martin Brennan 2024-07-08 11:09:30 +10:00 committed by GitHub
parent 5ca2c8b8ac
commit df6f950200
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 40 additions and 8 deletions

View File

@ -103,12 +103,6 @@ export const ADMIN_NAV_MAP = [
label: "admin.community.sidebar_link.legal",
icon: "gavel",
},
{
name: "admin_moderation_flags",
route: "adminConfig.flags",
label: "admin.community.sidebar_link.moderation_flags",
icon: "flag",
},
],
},
{

View File

@ -318,6 +318,15 @@ export default class AdminSidebarPanel extends BaseCustomSidebarPanel {
});
}
if (currentUser.show_experimental_flags_admin_page) {
navMap.findBy("name", "community").links.push({
name: "admin_moderation_flags",
route: "adminConfig.flags",
label: "admin.community.sidebar_link.moderation_flags",
icon: "flag",
});
}
navMap.forEach((section) =>
section.links.forEach((link) => {
if (link.keywords) {

View File

@ -76,7 +76,8 @@ class CurrentUserSerializer < BasicUserSerializer
:use_admin_sidebar,
:can_view_raw_email,
:use_glimmer_topic_list?,
:login_method
:login_method,
:show_experimental_flags_admin_page
delegate :user_stat, to: :object, private: true
delegate :any_posts, :draft_count, :pending_posts_count, :read_faq?, to: :user_stat
@ -137,7 +138,15 @@ class CurrentUserSerializer < BasicUserSerializer
object.staff? && object.in_any_groups?(SiteSetting.admin_sidebar_enabled_groups_map)
end
def include_user_admin_sidebar?
def include_use_admin_sidebar?
object.staff?
end
def show_experimental_flags_admin_page
object.in_any_groups?(SiteSetting.experimental_flags_admin_page_enabled_groups_map)
end
def include_show_experimental_flags_admin_page?
object.admin?
end

View File

@ -2427,6 +2427,12 @@ developer:
list_type: compact
allow_any: false
refresh: true
experimental_flags_admin_page_enabled_groups:
default: ""
type: group_list
list_type: compact
allow_any: false
refresh: true
navigation:
navigation_menu:

View File

@ -8,6 +8,7 @@ describe "Admin Flags Page", type: :system do
let(:topic_page) { PageObjects::Pages::Topic.new }
let(:admin_flags_page) { PageObjects::Pages::AdminFlags.new }
let(:admin_flag_form_page) { PageObjects::Pages::AdminFlagForm.new }
let(:sidebar) { PageObjects::Components::NavigationMenu::Sidebar.new }
before { sign_in(admin) }
@ -148,4 +149,17 @@ describe "Admin Flags Page", type: :system do
admin_flags_page.open_flag_menu("off_topic")
expect(page).not_to have_css(".dropdown-menu__item .move-up")
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