diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/admin-sidebar.js b/app/assets/javascripts/discourse/app/lib/sidebar/admin-sidebar.js index 79d26d7e3b7..192b6894d6c 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/admin-sidebar.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/admin-sidebar.js @@ -224,6 +224,7 @@ export default class AdminSidebarPanel extends BaseCustomSidebarPanel { const siteSettings = getOwnerWithFallback(this).lookup( "service:site-settings" ); + const session = getOwnerWithFallback(this).lookup("service:session"); if (!currentUser.use_admin_sidebar) { return []; } @@ -235,7 +236,9 @@ export default class AdminSidebarPanel extends BaseCustomSidebarPanel { const savedConfig = this.adminSidebarExperimentStateManager.navConfig; const navMap = savedConfig || ADMIN_NAV_MAP; - navMap.findBy("name", "plugins").links.push(...pluginAdminRouteLinks()); + if (!session.get("safe_mode")) { + navMap.findBy("name", "plugins").links.push(...pluginAdminRouteLinks()); + } if (siteSettings.experimental_form_templates) { navMap.findBy("name", "customize").links.push({ diff --git a/app/views/safe_mode/index.html.erb b/app/views/safe_mode/index.html.erb index 070d23d993b..dc7d5f5d8fd 100644 --- a/app/views/safe_mode/index.html.erb +++ b/app/views/safe_mode/index.html.erb @@ -34,7 +34,7 @@

- <%= submit_tag t('safe_mode.enter'), class: 'btn btn-danger' %> + <%= submit_tag t('safe_mode.enter'), class: 'btn btn-danger', id: "btn-enter-safe-mode" %> <%- if flash[:must_select] %> ⚠️ <%= t 'safe_mode.must_select' %> diff --git a/plugins/chat/spec/system/admin_sidebar_navigation_spec.rb b/plugins/chat/spec/system/admin_sidebar_navigation_spec.rb index ccdccf1d752..8505bc7cc1d 100644 --- a/plugins/chat/spec/system/admin_sidebar_navigation_spec.rb +++ b/plugins/chat/spec/system/admin_sidebar_navigation_spec.rb @@ -23,6 +23,14 @@ describe "Admin Revamp | Sidebar Navigation | Plugin Links", type: :system do expect(sidebar).to have_section_link("Chat", href: "/admin/plugins/chat", count: 1) end + it "does not show plugin links in the admin sidebar in safe mode" do + visit("/safe-mode") + find("#btn-enter-safe-mode").click + expect(sidebar).to have_section_link("Admin", href: "/admin") + sidebar.click_link_in_section("community", "admin") + expect(sidebar).to have_no_section_link("Chat", href: "/admin/plugins/chat") + end + describe "admin sidebar respects separated and combined sidebar modes" do it "reverts to always (separated) mode after entering and leaving admin section" do admin.user_option.update!(