A platform for community discussion. Free, open, simple.
FIX: Link to traffic report when legacy pageviews are enabled (#43674)
Alan Guo Xiang Tanc9d27d5d2e3b
diff --git a/frontend/discourse/admin/components/dashboard/traffic.gjs b/frontend/discourse/admin/components/dashboard/traffic.gjsindex 75d199189d4..66f45cf8877 100644--- a/frontend/discourse/admin/components/dashboard/traffic.gjs+++ b/frontend/discourse/admin/components/dashboard/traffic.gjs@@ -32,6 +32,7 @@ const PERIOD_COPY_KEYS = {export default class DashboardTraffic extends Component {@service currentUser;+ @service siteSettings;hiddenLabels = ["page_view_crawler"];@@ -163,6 +164,10 @@ export default class DashboardTraffic extends Component {return { range: this.args.period };}+ get showTrafficExplorerLink() {+ return this.currentUser.admin && !this.siteSettings.use_legacy_pageviews;+ }+formatHeadlineCount(value) {if (value >= 1_000_000) {const formatted = I18n.toNumber(value / 1_000_000, { precision: 1 });@@ -397,7 +402,7 @@ export default class DashboardTraffic extends Component {@options={{this.chartOptions}}/></div>- {{#if this.currentUser.admin}}+ {{#if this.showTrafficExplorerLink}}<LinkToclass="db-traffic__see-details"@query={{this.explorerQuery}}diff --git a/spec/system/admin_dashboard_redesign/site_traffic_section_spec.rb b/spec/system/admin_dashboard_redesign/site_traffic_section_spec.rbindex da366a19879..e3a764c49b1 100644--- a/spec/system/admin_dashboard_redesign/site_traffic_section_spec.rb+++ b/spec/system/admin_dashboard_redesign/site_traffic_section_spec.rb@@ -153,6 +153,17 @@ describe "Admin Dashboard Redesign | Site Traffic section" do)end+ it "keeps the aggregate traffic report available to admins when legacy pageviews are enabled" do+ SiteSetting.use_legacy_pageviews = true++ dashboard.visit_with_query(range: "custom", start_date: "2026-05-01", end_date: "2026-05-12")+ dashboard.site_traffic.click_see_details++ expect(page).to have_current_path(+ "/admin/reports/consolidated_page_views?end_date=2026-05-12&start_date=2026-05-01",+ )+ end+it "keeps the aggregate traffic report available to moderators" dosign_in(moderator)