From 4ddf7e61f99d42e22ad5ae36832882c734623614 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Mon, 9 Dec 2024 10:01:09 +1000 Subject: [PATCH] UX: Move "What's new?" link in admin sidebar to root section (#30144) This is so the link is more visible, instead of being buried in the Account section. --- .../discourse/app/lib/sidebar/admin-nav-map.js | 8 -------- .../discourse/app/lib/sidebar/admin-sidebar.js | 8 ++++++++ spec/system/admin_sidebar_navigation_spec.rb | 16 ++++++++-------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js b/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js index bddb7e0ac8c..e12852b14c6 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js @@ -11,14 +11,6 @@ export const ADMIN_NAV_MAP = [ label: "admin.account.sidebar_link.backups", icon: "box-archive", }, - { - name: "admin_whats_new", - route: "admin.whatsNew", - label: "admin.account.sidebar_link.whats_new.title", - icon: "gift", - keywords: "admin.account.sidebar_link.whats_new.keywords", - moderator: true, - }, ], }, { 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 ac12228719e..9f4ec7955aa 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/admin-sidebar.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/admin-sidebar.js @@ -208,6 +208,14 @@ export function useAdminNavConfig(navMap) { label: "admin.advanced.sidebar_link.all_site_settings", icon: "gear", }, + { + name: "admin_whats_new", + route: "admin.whatsNew", + label: "admin.account.sidebar_link.whats_new.title", + icon: "gift", + keywords: "admin.account.sidebar_link.whats_new.keywords", + moderator: true, + }, ], }, ]; diff --git a/spec/system/admin_sidebar_navigation_spec.rb b/spec/system/admin_sidebar_navigation_spec.rb index 0b5464b97c8..dc5cd06d859 100644 --- a/spec/system/admin_sidebar_navigation_spec.rb +++ b/spec/system/admin_sidebar_navigation_spec.rb @@ -50,8 +50,8 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do it "collapses sections by default" do visit("/admin") links = page.all(".sidebar-section-link-content-text") - expect(links.count).to eq(3) - expect(links.map(&:text)).to eq(["Dashboard", "Users", "All Site Settings"]) + expect(links.count).to eq(4) + expect(links.map(&:text)).to eq(["Dashboard", "Users", "All Site Settings", "What's New"]) end context "when on mobile" do @@ -173,8 +173,8 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do it "temporarily expands section when filter" do visit("/admin") links = page.all(".sidebar-section-link-content-text") - expect(links.count).to eq(3) - expect(links.map(&:text)).to eq(["Dashboard", "Users", "All Site Settings"]) + expect(links.count).to eq(4) + expect(links.map(&:text)).to eq(["Dashboard", "Users", "All Site Settings", "What's New"]) filter.filter("ie") links = page.all(".sidebar-section-link-content-text") @@ -183,8 +183,8 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do filter.filter("") links = page.all(".sidebar-section-link-content-text") - expect(links.count).to eq(3) - expect(links.map(&:text)).to eq(["Dashboard", "Users", "All Site Settings"]) + expect(links.count).to eq(4) + expect(links.map(&:text)).to eq(["Dashboard", "Users", "All Site Settings", "What's New"]) end it "allows further filtering of site settings or users if links do not show results" do @@ -223,9 +223,9 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do expect(page).to have_selector(".sidebar-section-link-content-text", minimum: 50) sidebar.toggle_all_sections - expect(page).to have_selector(".sidebar-section-link-content-text", count: 3) + expect(page).to have_selector(".sidebar-section-link-content-text", count: 4) expect(all(".sidebar-section-link-content-text").map(&:text)).to eq( - ["Dashboard", "Users", "All Site Settings"], + ["Dashboard", "Users", "All Site Settings", "What's New"], ) sidebar.toggle_all_sections