Skip to content

A platform for community discussion. Free, open, simple.

DEV: Remove `reporting_improvements` upcoming change (#41259)

Alan Guo Xiang Tand2aa6131fb89
diff --git a/app/assets/stylesheets/admin/admin_base.scss b/app/assets/stylesheets/admin/admin_base.scss
index a659ebb3ad8..84dee7eeba6 100644
--- a/app/assets/stylesheets/admin/admin_base.scss
+++ b/app/assets/stylesheets/admin/admin_base.scss
@@ -1293,7 +1293,6 @@ a.inline-editable-field {
@import "admin/admin_report_counters";
@import "admin/admin_report_chart";
@import "admin/admin_report_radar";
-@import "admin/admin_report_stacked_chart";
@import "admin/admin_report_stacked_line_chart";
@import "admin/admin_report_table";
@import "admin/admin_report_inline_table";
diff --git a/app/assets/stylesheets/admin/admin_report.scss b/app/assets/stylesheets/admin/admin_report.scss
index 7b0d857cb4d..2d24c36e494 100644
--- a/app/assets/stylesheets/admin/admin_report.scss
+++ b/app/assets/stylesheets/admin/admin_report.scss
@@ -128,100 +128,13 @@
}
}
-body:not(.uc-reporting-improvements) .admin-report {
- .body {
- display: flex;
- flex-direction: row;
- }
-
- .main {
- flex: 1;
- min-width: 0; // allow chart.js to shrink below intrinsic width
- }
-
- .average-chart {
- font-style: italic;
- text-align: center;
- color: var(--primary-high);
- margin-bottom: 1em;
- line-height: var(--line-height-medium);
- }
-
- .filters {
- display: flex;
- margin-left: 1em;
- flex-direction: column;
- width: 220px;
-
- .modes {
- margin: 0 0 1em 0;
- padding: 0;
- list-style: none;
-
- .mode {
- display: inline-flex;
- flex: 1 0 0px;
-
- .mode-btn.is-current {
- color: var(--tertiary);
- }
- }
- }
-
- .chart-groupings {
- display: grid;
- grid-template-columns: repeat(auto-fill, 1fr);
- gap: 0.5em;
- margin-bottom: 1em;
-
- .chart-grouping.active {
- background: var(--tertiary);
- color: var(--secondary);
- }
- }
-
- .control {
- margin-bottom: 1em;
- }
-
- .control .label {
- font-weight: 700;
- width: 100%;
- }
-
- .control .input,
- .control .select-kit {
- width: 100%;
-
- .export-csv-btn {
- width: 100%;
- }
-
- .refresh-report-btn {
- width: 100%;
- }
- }
- }
-}
-
.rtl .admin-report {
- .filters {
- margin-left: 0;
- margin-right: 1em;
- }
-
.trend {
margin-left: unset;
margin-right: auto;
}
}
-.admin-report.storage-stats {
- .main {
- flex: 1 1 auto;
- }
-}
-
.admin-reports-header {
display: flex;
align-items: center;
diff --git a/app/assets/stylesheets/admin/admin_report_chart.scss b/app/assets/stylesheets/admin/admin_report_chart.scss
index 4657f14f339..095a4afce9e 100644
--- a/app/assets/stylesheets/admin/admin_report_chart.scss
+++ b/app/assets/stylesheets/admin/admin_report_chart.scss
@@ -8,7 +8,7 @@
}
}
-body.uc-reporting-improvements .admin-contents:not(.dashboard) .chart {
+.admin-contents:not(.dashboard) .chart {
&__wrapper {
display: flex;
flex-direction: column;
diff --git a/app/assets/stylesheets/admin/admin_report_stacked_chart.scss b/app/assets/stylesheets/admin/admin_report_stacked_chart.scss
deleted file mode 100644
index 55a26ec4b23..00000000000
--- a/app/assets/stylesheets/admin/admin_report_stacked_chart.scss
+++ /dev/null
@@ -1,5 +0,0 @@
-body:not(.uc-reporting-improvements) .admin-report-stacked-chart {
- .chart-canvas-container {
- height: 250px;
- }
-}
diff --git a/app/assets/stylesheets/admin/admin_reports.scss b/app/assets/stylesheets/admin/admin_reports.scss
index 83fd5878edf..8bbd6d6527a 100644
--- a/app/assets/stylesheets/admin/admin_reports.scss
+++ b/app/assets/stylesheets/admin/admin_reports.scss
@@ -13,28 +13,3 @@
height: clamp(200px, 50vh, 350px);
}
}
-
-.mobile-view .admin-reports {
- .admin-report {
- .body {
- flex-direction: column;
-
- .filters {
- order: 0;
- margin: 0;
- width: 100%;
- }
-
- .main {
- order: 2;
- }
-
- .report-alert {
- margin: 0;
- order: 1;
- flex: 1 0 0px;
- padding: 1em;
- }
- }
- }
-}
diff --git a/app/assets/stylesheets/admin/dashboard.scss b/app/assets/stylesheets/admin/dashboard.scss
index c79467aeb23..c3350b19c77 100644
--- a/app/assets/stylesheets/admin/dashboard.scss
+++ b/app/assets/stylesheets/admin/dashboard.scss
@@ -356,8 +356,6 @@
padding: 0.65em 0.25em;
}
- .admin-report .main,
- //temp fix for reporting upcoming changes
.admin-report .chart__body {
border: 1px solid var(--content-border-color);
@@ -366,15 +364,12 @@
}
}
- // temp fix for reporting upcoming changes
.alert {
- .uc-reporting-improvements & {
- margin-bottom: 0;
- }
+ margin-bottom: 0;
}
.admin-report:not(:last-child) {
- .main {
+ .chart__body {
border-bottom: 0;
}
@@ -403,7 +398,7 @@
}
}
- .admin-report .main .report-alert {
+ .admin-report .chart__body .report-alert {
display: flex;
flex-direction: row;
padding: 0.5em 0.25em;
diff --git a/app/models/concerns/reports/visits.rb b/app/models/concerns/reports/visits.rb
index e62af800454..5bed5d06d99 100644
--- a/app/models/concerns/reports/visits.rb
+++ b/app/models/concerns/reports/visits.rb
@@ -10,26 +10,7 @@ module Reports::Visits
report.icon = "user"
- if SiteSetting.reporting_improvements
- report_visits_stacked(report, group_filter)
- else
- basic_report_about report,
- UserVisit,
- :by_day,
- report.start_date,
- report.end_date,
- group_filter
- add_counts report, UserVisit, "visited_at"
-
- if report.facets.include?(:prev30Days)
- report.prev30Days =
- UserVisit.where(
- "visited_at >= ? AND visited_at < ?",
- report.start_date - 30.days,
- report.start_date,
- ).count
- end
- end
+ report_visits_stacked(report, group_filter)
end
private
@@ -56,20 +37,25 @@ module Reports::Visits
end
end
- report.data = [
- {
- req: "desktop",
- label: I18n.t("reports.visits.xaxis.desktop"),
- color: report.colors[:turquoise],
- data: desktop_data,
- },
- {
- req: "mobile",
- label: I18n.t("reports.visits.xaxis.mobile"),
- color: report.colors[:lime],
- data: mobile_data,
- },
- ]
+ report.data =
+ if results.empty?
+ []
+ else
+ [
+ {
+ req: "desktop",
+ label: I18n.t("reports.visits.xaxis.desktop"),
+ color: report.colors[:turquoise],
+ data: desktop_data,
+ },
+ {
+ req: "mobile",
+ label: I18n.t("reports.visits.xaxis.mobile"),
+ color: report.colors[:lime],
+ data: mobile_data,
+ },
+ ]
+ end
report.total = results.first&.total || 0
diff --git a/app/models/report.rb b/app/models/report.rb
index 803c8016faf..4c58f4cea68 100644
--- a/app/models/report.rb
+++ b/app/models/report.rb
@@ -3,7 +3,7 @@
class Report
# Change this line each time report format change
# and you want to ensure cache is reset
- SCHEMA_VERSION = 4
+ SCHEMA_VERSION = 5
FILTERS = %i[
name
@@ -355,7 +355,7 @@ class Report
report.guardian ||= report.current_user&.guardian
report.labels = Report.default_labels
- report.legacy = LEGACY_REPORTS.include?(type) if SiteSetting.reporting_improvements
+ report.legacy = LEGACY_REPORTS.include?(type)
report
end
diff --git a/app/queries/reports/list_query.rb b/app/queries/reports/list_query.rb
index 02cc96f0c63..1da2573ec72 100644
--- a/app/queries/reports/list_query.rb
+++ b/app/queries/reports/list_query.rb
@@ -12,11 +12,8 @@ module Reports
def visible?(guardian:)
return false if Report.hidden?(type, guardian:)
-
- if SiteSetting.reporting_improvements
- return false if plugin_report? && plugin_disabled?
- return false if Report::LEGACY_REPORTS.include?(type)
- end
+ return false if plugin_report? && plugin_disabled?
+ return false if Report::LEGACY_REPORTS.include?(type)
true
end
@@ -29,7 +26,7 @@ module Reports
description_link: I18n.t("reports.#{type}.description_link", default: "").presence,
}
- if SiteSetting.reporting_improvements && plugin_report?
+ if plugin_report?
result[:plugin] = plugin_name
result[:plugin_display_name] = plugin_display_name
end
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 473a4bdeb40..0b084ffd2e8 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -2930,7 +2930,6 @@ en:
enable_simplified_category_creation: "Enables a simplified category creation flow with fewer options and a cleaner interface."
modernize_foundation_theme: "This change introduces design modifcations to the Foundation theme in Discourse."
enable_horizon_high_context_topic_cards: "Shows richer topic cards in the Horizon theme, including topic excerpts, tags, and plugin extended information."
- reporting_improvements: "Improvements to navigation, design, and usability for Discourse's admin reports."
granular_anonymous_and_logged_in_groups_permissions: "Makes group-based site setting permissions treat 'everyone' as 'all logged-in users', and enables the new 'anonymous_users' and 'logged_in_users' pseudogroups so admins can explicitly target anonymous visitors and authenticated users."
dashboard_improvements: "Enables the redesigned admin dashboard that lets you pin custom reports and includes improved site traffic, engagement, and other analytics tied to community success and value."
diff --git a/config/site_settings.yml b/config/site_settings.yml
index 0a9e062267e..f678b12b7c2 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -4468,19 +4468,6 @@ dashboard:
client: true
experimental:
- reporting_improvements:
- default: false
- client: true
- hidden: true
- area: "experimental"
- upcoming_change:
- status: "beta"
- impact: "feature,staff"
- learn_more_url: "https://meta.discourse.org/t/-/395768"
- allow_enabled_for:
- - staff
- - specific_groups
- body_class: true
enable_auto_grid_images:
default: true
client: true
diff --git a/db/post_migrate/20260629081606_remove_reporting_improvements_setting.rb b/db/post_migrate/20260629081606_remove_reporting_improvements_setting.rb
new file mode 100644
index 00000000000..1c11f9db078
--- /dev/null
+++ b/db/post_migrate/20260629081606_remove_reporting_improvements_setting.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+class RemoveReportingImprovementsSetting < ActiveRecord::Migration[8.0]
+ def up
+ execute(<<~SQL)
+ DELETE FROM site_settings WHERE name = 'reporting_improvements'
+ SQL
+
+ execute(<<~SQL)
+ DELETE FROM site_setting_groups WHERE name = 'reporting_improvements'
+ SQL
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index 21c10f1feaa..c74b7888d2b 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -22283,6 +22283,7 @@ SET search_path TO "$user", public;
INSERT INTO "schema_migrations" (version) VALUES
('20260629233141'),
+('20260629081606'),
('20260629022603'),
('20260626055145'),
('20260624140945'),
diff --git a/frontend/discourse/admin/components/admin-report-new.gjs b/frontend/discourse/admin/components/admin-report-body.gjs
similarity index 98%
rename from frontend/discourse/admin/components/admin-report-new.gjs
rename to frontend/discourse/admin/components/admin-report-body.gjs
index 488070729d3..0e3a3c8f51f 100644
--- a/frontend/discourse/admin/components/admin-report-new.gjs
+++ b/frontend/discourse/admin/components/admin-report-body.gjs
@@ -26,11 +26,7 @@ import { i18n } from "discourse-i18n";
{{#unless @report.isHidden}}
<DConditionalLoadingSection @isLoading={{@report.isLoading}}>
{{#if @report.showHeader}}
- {{#if
- (and
- @report.siteSettings.reporting_improvements @report.model.legacy
- )
- }}
+ {{#if @report.model.legacy}}
<div class="alert alert-info">
{{dIcon "triangle-exclamation"}}
<span>{{i18n "admin.reports.legacy_warning"}}</span>
diff --git a/frontend/discourse/admin/components/admin-report-legacy.gjs b/frontend/discourse/admin/components/admin-report-legacy.gjs
deleted file mode 100644
index 34f2e1f8ce4..00000000000
--- a/frontend/discourse/admin/components/admin-report-legacy.gjs
+++ /dev/null
@@ -1,264 +0,0 @@
-import { concat, fn } from "@ember/helper";
-import didUpdate from "@ember/render-modifiers/modifiers/did-update";
-import AdminReport from "discourse/admin/components/admin-report";
-import DTooltip from "discourse/float-kit/components/d-tooltip";
-import { and } from "discourse/truth-helpers";
-import DButton from "discourse/ui-kit/d-button";
-import DConditionalLoadingSection from "discourse/ui-kit/d-conditional-loading-section";
-import DDateTimeInputRange from "discourse/ui-kit/d-date-time-input-range";
-import DPageSubheader from "discourse/ui-kit/d-page-subheader";
-import dConcatClass from "discourse/ui-kit/helpers/d-concat-class";
-import dIcon from "discourse/ui-kit/helpers/d-icon";
-import dNumber from "discourse/ui-kit/helpers/d-number";
-import { i18n } from "discourse-i18n";
-
-<template>
- <div
- class={{dConcatClass "admin-report" @report.reportClasses}}
- {{didUpdate
- @report.fetchOrRender
- @filters.startDate
- @filters.endDate
- @report.preloadedData
- }}
- >
- {{#unless @report.isHidden}}
- <DConditionalLoadingSection @isLoading={{@report.isLoading}}>
- {{#if
- (and @report.siteSettings.reporting_improvements @report.model.legacy)
- }}
- <div class="alert alert-info">
- {{dIcon "triangle-exclamation"}}
- <span>{{i18n "admin.reports.legacy_warning"}}</span>
- </div>
- {{/if}}
- {{#if @report.showHeader}}
- <div class="header">
- {{#unless @report.showNotFoundError}}
- <DPageSubheader
- @titleLabel={{@report.model.title}}
- @titleUrl={{@report.model.reportUrl}}
- @descriptionLabel={{unless
- @report.showDescriptionInTooltip
- @report.model.description
- }}
- @learnMoreUrl={{@report.model.description_link}}
- />
-
- {{#if @report.showDescriptionInTooltip}}
- {{#if @report.model.description}}
- <DTooltip
- @interactive={{@report.model.description_link.length}}
- >
- <:trigger>
- {{dIcon "circle-question"}}
- </:trigger>
- <:content>
- {{#if @report.model.description_link}}
- <a
- target="_blank"
- rel="noopener noreferrer"
- href={{@report.model.description_link}}
- class="info"
- >
- {{@report.model.description}}
- </a>
- {{else}}
- <span>{{@report.model.description}}</span>
- {{/if}}
- </:content>
- </DTooltip>
- {{/if}}
- {{/if}}
- {{/unless}}
-
- {{#if @report.shouldDisplayTrend}}
- <div class="trend {{@report.model.trend}}">
- <span class="value" title={{@report.model.trendTitle}}>
- {{#if @report.model.average}}
- {{dNumber @report.model.currentAverage}}{{#if
- @report.model.percent
- }}%{{/if}}
- {{else}}
- {{dNumber @report.model.currentTotal noTitle="true"}}{{#if
- @report.model.percent
- }}%{{/if}}
- {{/if}}
-
- {{#if @report.model.trendIcon}}
- {{dIcon @report.model.trendIcon class="icon"}}
- {{/if}}
- </span>
- </div>
- {{/if}}
- </div>
- {{/if}}
-
- <div class="body">
- <div class="main">
- {{#if @report.showError}}
- {{#if @report.showTimeoutError}}
- <div class="alert alert-error report-alert timeout">
- {{dIcon "triangle-exclamation"}}
- <span>{{i18n "admin.dashboard.timeout_error"}}</span>
- </div>
- {{/if}}
-
- {{#if @report.showExceptionError}}
- <div class="alert alert-error report-alert exception">
- {{dIcon "triangle-exclamation"}}
- <span>{{i18n "admin.dashboard.exception_error"}}</span>
- </div>
- {{/if}}
-
- {{#if @report.showNotFoundError}}
- <div class="alert alert-error report-alert not-found">
- {{dIcon "triangle-exclamation"}}
- <span>{{i18n "admin.dashboard.not_found_error"}}</span>
- </div>
- {{/if}}
- {{else}}
- {{#if @report.hasData}}
- {{#if @report.currentMode}}
- {{component
- @report.modeComponent
- }}
-
- {{#if @report.model.relatedReport}}
- <AdminReport
- @showFilteringUI={{false}}
- @dataSourceName={{@report.model.relatedReport.type}}
- />
- {{/if}}
- {{/if}}
- {{else}}
- {{#if @report.rateLimitationString}}
- <div class="alert alert-error report-alert rate-limited">
- {{dIcon "temperature-three-quarters"}}
- <span>{{@report.rateLimitationString}}</span>
- </div>
- {{else}}
- <div class="alert alert-info report-alert no-data">
- {{dIcon "chart-pie"}}
- {{#if @report.model.reportUrl}}
- <a href={{@report.model.reportUrl}} class="report-url">
- <span>
- {{#if @report.model.title}}
- {{@report.model.title}}
- —
- {{/if}}
- {{i18n "admin.dashboard.reports.no_data"}}
- </span>
- </a>
- {{else}}
- <span>{{i18n "admin.dashboard.reports.no_data"}}</span>
- {{/if}}
- </div>
- {{/if}}
- {{/if}}
- {{/if}}
- </div>
-
- {{#if @report.showFilteringUI}}
- <div class="filters">
- {{#if @report.showModes}}
- <div class="modes">
- {{#each @report.displayedModes as |displayedMode|}}
- <DButton
- @action={{fn @report.onChangeMode displayedMode.mode}}
- @icon={{displayedMode.icon}}
- class={{displayedMode.cssClass}}
- />
- {{/each}}
- </div>
- {{/if}}
-
- {{#if @report.isChartMode}}
- {{#if @report.model.average}}
- <span class="average-chart">
- {{i18n "admin.dashboard.reports.average_chart_label"}}
- </span>
- {{/if}}
- <div class="chart-groupings">
- {{#each @report.chartGroupings as |chartGrouping|}}
- <DButton
- @label={{chartGrouping.label}}
- @action={{fn @report.changeGrouping chartGrouping.id}}
- @disabled={{chartGrouping.disabled}}
- class={{chartGrouping.class}}
- />
- {{/each}}
- </div>
- {{/if}}
-
- {{#if @report.showDatesOptions}}
- <div class="control">
- <span class="label">
- {{i18n "admin.dashboard.reports.dates"}}
- </span>
-
- <div class="input">
- <DDateTimeInputRange
- @from={{@report.startDate}}
- @to={{@report.endDate}}
- @onChange={{@report.onChangeDateRange}}
- @showFromTime={{false}}
- @showToTime={{false}}
- />
- </div>
- </div>
- {{/if}}
-
- {{#each @report.model.available_filters as |filter|}}
- <div class="control">
- <span class="label">
- {{i18n
- (concat
- "admin.dashboard.reports.filters." filter.id ".label"
- )
- }}
- </span>
-
- <div class="input">
- {{component
- (@report.reportFilterComponent filter)
- filter=filter
- }}
- </div>
- </div>
- {{/each}}
-
- <div class="control">
- <div class="input">
- <DButton
- @action={{@report.exportCsv}}
- @label="admin.export_csv.button_text"
- @icon="download"
- class="btn-default export-csv-btn"
- />
- </div>
- </div>
-
- {{#if @report.showRefresh}}
- <div class="control">
- <div class="input">
- <DButton
- @action={{@report.refreshReport}}
- @label="admin.dashboard.reports.refresh_report"
- @icon="arrows-rotate"
- class="refresh-report-btn btn-primary"
- />
- </div>
- </div>
- {{/if}}
- </div>
- {{/if}}
- </div>
- </DConditionalLoadingSection>
- {{/unless}}
- </div>
-</template>
diff --git a/frontend/discourse/admin/components/admin-report.gjs b/frontend/discourse/admin/components/admin-report.gjs
index 0136d5eb0b4..6e7e65745fd 100644
--- a/frontend/discourse/admin/components/admin-report.gjs
+++ b/frontend/discourse/admin/components/admin-report.gjs
@@ -4,11 +4,10 @@ import EmberObject, { action } from "@ember/object";
import { next } from "@ember/runloop";
import { service } from "@ember/service";
import { isPresent } from "@ember/utils";
+import AdminReportBody from "discourse/admin/components/admin-report-body";
import AdminReportChart from "discourse/admin/components/admin-report-chart";
import AdminReportCounters from "discourse/admin/components/admin-report-counters";
import AdminReportInlineTable from "discourse/admin/components/admin-report-inline-table";
-import AdminReportLegacy from "discourse/admin/components/admin-report-legacy";
-import AdminReportNew from "discourse/admin/components/admin-report-new";
import AdminReportRadar from "discourse/admin/components/admin-report-radar";
import AdminReportStackedChart from "discourse/admin/components/admin-report-stacked-chart";
import AdminReportStackedLineChart from "discourse/admin/components/admin-report-stacked-line-chart";
@@ -191,7 +190,7 @@ export default class AdminReport extends Component {
changeGrouping(grouping) {
const options = { chartGrouping: grouping };
- if (this.siteSettings.reporting_improvements && !this.userHasCustomDates) {
+ if (!this.userHasCustomDates) {
const endDate = moment().endOf("day");
let startDate;
@@ -589,10 +588,6 @@ export default class AdminReport extends Component {
}
<template>
- {{#if this.siteSettings.reporting_improvements}}
- <AdminReportNew @report={{this}} @filters={{@filters}} />
- {{else}}
- <AdminReportLegacy @report={{this}} @filters={{@filters}} />
- {{/if}}
+ <AdminReportBody @report={{this}} @filters={{@filters}} />
</template>
}
diff --git a/frontend/discourse/admin/components/admin-reports.gjs b/frontend/discourse/admin/components/admin-reports.gjs
index 4cd8a61b029..b4183cd29d4 100644
--- a/frontend/discourse/admin/components/admin-reports.gjs
+++ b/frontend/discourse/admin/components/admin-reports.gjs
@@ -162,34 +162,21 @@ export default class AdminReports extends Component {
@noResultsMessage={{i18n "admin.filter_reports_no_results"}}
>
<:content as |filteredReports|>
- {{#if this.siteSettings.reporting_improvements}}
- {{#each (this.groupReports filteredReports) as |group|}}
- <section class="admin-reports-group">
- <h2 class="admin-reports-group__title">{{group.name}}</h2>
- <AdminSectionLandingWrapper class="admin-reports-list">
- {{#each group.reports as |report|}}
- <AdminSectionLandingItem
- @titleLabelTranslated={{report.title}}
- @descriptionLabelTranslated={{report.description}}
- @titleRoute="adminReports.show"
- @titleRouteModel={{report.type}}
- />
- {{/each}}
- </AdminSectionLandingWrapper>
- </section>
- {{/each}}
- {{else}}
- <AdminSectionLandingWrapper class="admin-reports-list">
- {{#each filteredReports as |report|}}
- <AdminSectionLandingItem
- @titleLabelTranslated={{report.title}}
- @descriptionLabelTranslated={{report.description}}
- @titleRoute="adminReports.show"
- @titleRouteModel={{report.type}}
- />
- {{/each}}
- </AdminSectionLandingWrapper>
- {{/if}}
+ {{#each (this.groupReports filteredReports) as |group|}}
+ <section class="admin-reports-group">
+ <h2 class="admin-reports-group__title">{{group.name}}</h2>
+ <AdminSectionLandingWrapper class="admin-reports-list">
+ {{#each group.reports as |report|}}
+ <AdminSectionLandingItem
+ @titleLabelTranslated={{report.title}}
+ @descriptionLabelTranslated={{report.description}}
+ @titleRoute="adminReports.show"
+ @titleRouteModel={{report.type}}
+ />
+ {{/each}}
+ </AdminSectionLandingWrapper>
+ </section>
+ {{/each}}
</:content>
</AdminFilterControls>
</:content>
diff --git a/frontend/discourse/admin/controllers/admin-reports.js b/frontend/discourse/admin/controllers/admin-reports.js
index da792f4cad3..330bcffce9d 100644
--- a/frontend/discourse/admin/controllers/admin-reports.js
+++ b/frontend/discourse/admin/controllers/admin-reports.js
@@ -3,17 +3,8 @@ import { service } from "@ember/service";
export default class AdminReportsController extends Controller {
@service router;
- @service siteSettings;
-
- get reportingImprovements() {
- return this.siteSettings.reporting_improvements;
- }
get showHeader() {
return this.router.currentRouteName === "adminReports.index";
}
-
- get hideTabs() {
- return ["adminReports.show"].includes(this.router.currentRouteName);
- }
}
diff --git a/frontend/discourse/admin/controllers/admin/dashboard-reports.js b/frontend/discourse/admin/controllers/admin/dashboard-reports.js
deleted file mode 100644
index b332e992815..00000000000
--- a/frontend/discourse/admin/controllers/admin/dashboard-reports.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import Controller from "@ember/controller";
-import { action, computed, get } from "@ember/object";
-import discourseDebounce from "discourse/lib/debounce";
-import { INPUT_DELAY } from "discourse/lib/environment";
-
-export default class AdminDashboardReportsController extends Controller {
- filter = null;
-
- @computed("model.[]", "filter", "siteSettings.dashboard_hidden_reports")
- get filteredReports() {
- let reports = this.model;
- let filter = this.filter;
- if (filter) {
- filter = filter.toLowerCase();
- reports = reports.filter((report) => {
- return (
- (get(report, "title") || "").toLowerCase().includes(filter) ||
- (get(report, "description") || "").toLowerCase().includes(filter)
- );
- });
- }
-
- const hiddenReports = (this.siteSettings.dashboard_hidden_reports || "")
- .split("|")
- .filter(Boolean);
- reports = reports.filter((report) => !hiddenReports.includes(report.type));
-
- return reports;
- }
-
- @action
- filterReports(filter) {
- discourseDebounce(this, this._performFiltering, filter, INPUT_DELAY);
- }
-
- _performFiltering(filter) {
- this.set("filter", filter);
- }
-}
diff --git a/frontend/discourse/admin/models/report.js b/frontend/discourse/admin/models/report.js
index 91ed2db8139..fff1664df08 100644
--- a/frontend/discourse/admin/models/report.js
+++ b/frontend/discourse/admin/models/report.js
@@ -17,7 +17,7 @@ import I18n, { i18n } from "discourse-i18n";
// Change this line each time report format change
// and you want to ensure cache is reset
-export const SCHEMA_VERSION = 4;
+export const SCHEMA_VERSION = 5;
export default class Report extends EmberObject {
static groupingForDatapoints(count) {
diff --git a/frontend/discourse/admin/routes/admin/dashboard-reports.js b/frontend/discourse/admin/routes/admin/dashboard-reports.js
index 1942cab35aa..7ecf7b3779d 100644
--- a/frontend/discourse/admin/routes/admin/dashboard-reports.js
+++ b/frontend/discourse/admin/routes/admin/dashboard-reports.js
@@ -1,26 +1,10 @@
import { service } from "@ember/service";
-import { ajax } from "discourse/lib/ajax";
import DiscourseRoute from "discourse/routes/discourse";
export default class AdminDashboardReportsRoute extends DiscourseRoute {
@service router;
- @service siteSettings;
beforeModel() {
- if (this.siteSettings.reporting_improvements) {
- this.router.replaceWith("adminReports");
- }
- }
-
- model() {
- if (!this.siteSettings.reporting_improvements) {
- return ajax("/admin/reports");
- }
- }
-
- setupController(controller, model) {
- if (!this.siteSettings.reporting_improvements) {
- controller.setProperties({ model: model.reports, filter: null });
- }
+ this.router.replaceWith("adminReports");
}
}
diff --git a/frontend/discourse/admin/templates/admin-reports.gjs b/frontend/discourse/admin/templates/admin-reports.gjs
index 4d0d3307f91..c4e20a803e9 100644
--- a/frontend/discourse/admin/templates/admin-reports.gjs
+++ b/frontend/discourse/admin/templates/admin-reports.gjs
@@ -1,52 +1,22 @@
import DBreadcrumbsItem from "discourse/ui-kit/d-breadcrumbs-item";
-import DNavItem from "discourse/ui-kit/d-nav-item";
import DPageHeader from "discourse/ui-kit/d-page-header";
import { i18n } from "discourse-i18n";
export default <template>
- {{#if @controller.reportingImprovements}}
- {{#if @controller.showHeader}}
- <DPageHeader
- @titleLabel={{i18n "admin.config.reports.title"}}
- @descriptionLabel={{i18n "admin.config.reports.header_description"}}
- @learnMoreUrl="https://meta.discourse.org/t/-/240233"
- >
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/reports"
- @label={{i18n "admin.config.reports.title"}}
- />
- </:breadcrumbs>
- </DPageHeader>
- {{/if}}
- {{else}}
- {{#if @controller.showHeader}}
- <DPageHeader
- @titleLabel={{i18n "admin.config.reports.title"}}
- @descriptionLabel={{i18n "admin.config.reports.header_description"}}
- @learnMoreUrl="https://meta.discourse.org/t/-/240233"
- @hideTabs={{@controller.hideTabs}}
- >
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/reports"
- @label={{i18n "admin.config.reports.title"}}
- />
- </:breadcrumbs>
- <:tabs>
- <DNavItem
- @route="adminReports.dashboardSettings"
- @label="admin.config.reports.sub_pages.settings.title"
- />
- <DNavItem
- @route="adminReports.index"
- @label="admin.config.reports.title"
- />
- </:tabs>
- </DPageHeader>
- {{/if}}
+ {{#if @controller.showHeader}}
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.reports.title"}}
+ @descriptionLabel={{i18n "admin.config.reports.header_description"}}
+ @learnMoreUrl="https://meta.discourse.org/t/-/240233"
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/reports"
+ @label={{i18n "admin.config.reports.title"}}
+ />
+ </:breadcrumbs>
+ </DPageHeader>
{{/if}}
<div class="admin-container admin-config-page__main-area">
diff --git a/frontend/discourse/admin/templates/admin/dashboard-reports.gjs b/frontend/discourse/admin/templates/admin/dashboard-reports.gjs
deleted file mode 100644
index dc0fd1cb688..00000000000
--- a/frontend/discourse/admin/templates/admin/dashboard-reports.gjs
+++ /dev/null
@@ -1,3 +0,0 @@
-import AdminReports from "discourse/admin/components/admin-reports";
-
-export default <template><AdminReports /></template>
diff --git a/frontend/discourse/admin/templates/admin/dashboard.gjs b/frontend/discourse/admin/templates/admin/dashboard.gjs
index 6bd89906aab..43b651d7317 100644
--- a/frontend/discourse/admin/templates/admin/dashboard.gjs
+++ b/frontend/discourse/admin/templates/admin/dashboard.gjs
@@ -96,7 +96,7 @@ export default <template>
{{#if @controller.isReportsTabVisible}}
<li class="navigation-item reports">
- <LinkTo @route="admin.dashboardReports" class="navigation-link">
+ <LinkTo @route="adminReports" class="navigation-link">
{{i18n "admin.dashboard.reports_tab"}}
</LinkTo>
</li>
diff --git a/frontend/discourse/app/resolver-shims.js b/frontend/discourse/app/resolver-shims.js
index 28346db186b..7328428f135 100644
--- a/frontend/discourse/app/resolver-shims.js
+++ b/frontend/discourse/app/resolver-shims.js
@@ -148,7 +148,6 @@ export default {
"route:subscribe-index": "route:subscribe.index",
"controller:admin-dashboard-moderation":
"controller:admin.dashboard-moderation",
- "controller:admin-dashboard-reports": "controller:admin.dashboard-reports",
"route:admin-dashboard-reports": "route:admin.dashboard-reports",
"controller:admin-email-logs-sent": "controller:admin-email-logs.sent",
"route:admin-email-logs-sent": "route:admin-email-logs.sent",
diff --git a/frontend/discourse/tests/acceptance/dashboard-test.js b/frontend/discourse/tests/acceptance/dashboard-test.js
index a9c5d58920a..bbf223fb7fe 100644
--- a/frontend/discourse/tests/acceptance/dashboard-test.js
+++ b/frontend/discourse/tests/acceptance/dashboard-test.js
@@ -1,4 +1,4 @@
-import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
+import { click, currentURL, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
@@ -114,40 +114,18 @@ acceptance("Dashboard", function (needs) {
.exists();
});
- test("reports tab", async function (assert) {
+ test("reports tab navigates to the reports page", async function (assert) {
await visit("/admin");
await click(".dashboard .navigation-item.reports .navigation-link");
- assert
- .dom(
- ".dashboard .admin-reports-list .admin-section-landing-item__content"
- )
- .exists({ count: 1 });
-
- await fillIn(".dashboard .admin-filter-controls__input", "flags");
-
- assert
- .dom(
- ".dashboard .admin-reports-list .admin-section-landing-item__content"
- )
- .doesNotExist();
-
- await click(".dashboard .navigation-item.security .navigation-link");
- await click(".dashboard .navigation-item.reports .navigation-link");
-
- assert
- .dom(
- ".dashboard .admin-reports-list .admin-section-landing-item__content"
- )
- .exists({ count: 1 }, "navigating back and forth resets filter");
+ assert.strictEqual(currentURL(), "/admin/reports");
+ assert.dom(".admin-reports-group").exists("shows the grouped reports");
+ });
- await fillIn(".dashboard .admin-filter-controls__input", "activities");
+ test("old dashboard reports URL redirects to the reports page", async function (assert) {
+ await visit("/admin/dashboard/reports");
- assert
- .dom(
- ".dashboard .admin-reports-list .admin-section-landing-item__content"
- )
- .exists({ count: 1 }, "filter is case insensitive");
+ assert.strictEqual(currentURL(), "/admin/reports");
});
test("reports filters", async function (assert) {
diff --git a/frontend/discourse/tests/acceptance/reports-test.js b/frontend/discourse/tests/acceptance/reports-test.js
index 125175d0608..bd5d58c4b6c 100644
--- a/frontend/discourse/tests/acceptance/reports-test.js
+++ b/frontend/discourse/tests/acceptance/reports-test.js
@@ -34,7 +34,6 @@ acceptance("Reports", function (needs) {
acceptance("Reports | Plugin groups sorted by display name", function (needs) {
needs.user();
- needs.settings({ reporting_improvements: true });
needs.pretender((server, helper) => {
server.get("/admin/reports", () => {
return helper.response({
diff --git a/frontend/discourse/tests/fixtures/reports-bulk.js b/frontend/discourse/tests/fixtures/reports-bulk.js
index 52b00f3d0a0..062e33afbe8 100644
--- a/frontend/discourse/tests/fixtures/reports-bulk.js
+++ b/frontend/discourse/tests/fixtures/reports-bulk.js
@@ -59,7 +59,7 @@ let signups = {
prev_end_date: "2018-06-17T00:00:00Z",
prev30Days: null,
dates_filtering: true,
- report_key: "reports:signups:start:end:[:prev_period]:4",
+ report_key: `reports:signups:start:end:[:prev_period]:${SCHEMA_VERSION}`,
available_filters: [
{
id: "group",
@@ -83,27 +83,24 @@ let signups = {
let signups_fixture = JSON.parse(JSON.stringify(signups));
signups_fixture.type = "signups_exception";
signups_fixture.error = "exception";
-signups_fixture.report_key =
- "reports:signups_exception:start:end:[:prev_period]:4";
+signups_fixture.report_key = `reports:signups_exception:start:end:[:prev_period]:${SCHEMA_VERSION}`;
const signups_exception = signups_fixture;
signups_fixture = JSON.parse(JSON.stringify(signups));
signups_fixture.type = "signups_timeout";
signups_fixture.error = "timeout";
-signups_fixture.report_key =
- "reports:signups_timeout:start:end:[:prev_period]:4";
+signups_fixture.report_key = `reports:signups_timeout:start:end:[:prev_period]:${SCHEMA_VERSION}`;
const signups_timeout = signups_fixture;
signups_fixture = JSON.parse(JSON.stringify(signups));
signups_fixture.type = "not_found";
signups_fixture.error = "not_found";
-signups_fixture.report_key = "reports:not_found:start:end:[:prev_period]:4";
+signups_fixture.report_key = `reports:not_found:start:end:[:prev_period]:${SCHEMA_VERSION}`;
const signups_not_found = signups_fixture;
signups_fixture = JSON.parse(JSON.stringify(signups));
signups_fixture.type = "signups_with_groups";
-signups_fixture.report_key =
- 'reports:signups_with_groups:start:end:[:prev_period]:50:{"group":"88"}:4';
+signups_fixture.report_key = `reports:signups_with_groups:start:end:[:prev_period]:50:{"group":"88"}:${SCHEMA_VERSION}`;
const signups_with_group = signups_fixture;
const startDate = moment()
diff --git a/frontend/discourse/tests/integration/components/admin-report-test.gjs b/frontend/discourse/tests/integration/components/admin-report-test.gjs
index 59f90c7e043..24a3081ce5c 100644
--- a/frontend/discourse/tests/integration/components/admin-report-test.gjs
+++ b/frontend/discourse/tests/integration/components/admin-report-test.gjs
@@ -1,4 +1,4 @@
-import { click, fillIn, render } from "@ember/test-helpers";
+import { click, fillIn, render, triggerEvent } from "@ember/test-helpers";
import { module, test } from "qunit";
import AdminReport from "discourse/admin/components/admin-report";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
@@ -9,12 +9,7 @@ module("Integration | Component | AdminReport", function (hooks) {
test("default", async function (assert) {
await render(
- <template>
- <AdminReport
- @dataSourceName="signups"
- @showDescriptionInTooltip={{false}}
- />
- </template>
+ <template><AdminReport @dataSourceName="signups" /></template>
);
assert.dom(".admin-report.signups").exists();
@@ -22,11 +17,13 @@ module("Integration | Component | AdminReport", function (hooks) {
assert
.dom(".d-page-subheader .d-page-subheader__title")
.hasText("Signups", "has a title");
+
+ await triggerEvent(".fk-d-tooltip__trigger", "pointermove");
assert
- .dom(".d-page-subheader .d-page-subheader__description")
- .hasText(
+ .dom(".fk-d-tooltip__content")
+ .includesText(
"New account registrations for this period",
- "has a description"
+ "shows the description in a tooltip"
);
assert
@@ -154,11 +151,7 @@ module("Integration | Component | AdminReport", function (hooks) {
assert.dom(".alert-error.not-found").exists("displays a not found error");
});
- module("grouping date range updates", function (nestedHooks) {
- nestedHooks.beforeEach(function () {
- this.siteSettings.reporting_improvements = true;
- });
-
+ module("grouping date range updates", function () {
test("changing grouping to weekly updates date range to 3 months", async function (assert) {
const refreshArgs = [];
const refreshCallback = (options) => {
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/admin-report-sentiment-analysis.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/admin-report-sentiment-analysis.gjs
index efa7a6945c8..43daab70078 100644
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/admin-report-sentiment-analysis.gjs
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/admin-report-sentiment-analysis.gjs
@@ -30,7 +30,6 @@ import DoughnutChart from "./doughnut-chart";
export default class AdminReportSentimentAnalysis extends Component {
@service router;
- @service siteSettings;
@tracked selectedChart = null;
@tracked posts = [];
@@ -331,109 +330,55 @@ export default class AdminReportSentimentAnalysis extends Component {
<span {{didInsert this.openToChart}}></span>
{{#unless this.showingSelectedChart}}
- {{#if this.siteSettings.reporting_improvements}}
- <table class="sentiment-analysis-table md-table">
- <thead>
- <th>{{this.groupingType}}</th>
- <th>{{i18n
- "discourse_ai.sentiments.sentiment_analysis.table.total_count"
- }}</th>
- <th>{{i18n
- "discourse_ai.sentiments.sentiment_analysis.table.sentiment"
- }}</th>
- </thead>
-
- <tbody>
- {{#each this.transformedData as |data|}}
- <tr
- class="sentiment-analysis-table__row"
- role="button"
- {{on "click" (fn this.showDetails data)}}
- >
- <td class="sentiment-analysis-table__title">
- {{#if data.category}}
- {{dCategoryBadge data.category}}
- {{else}}
- {{data.title}}
- {{/if}}
- </td>
- <td
- class="sentiment-analysis-table__total-score"
- >{{data.total_score}}</td>
- <td class="sentiment-horizontal-bar">
- <AiSentimentHorizontalBar
- @type="positive"
- @score={{data.score_map.positive}}
- @width={{data.widths.positive}}
- />
- <AiSentimentHorizontalBar
- @type="negative"
- @score={{data.score_map.negative}}
- @width={{data.widths.negative}}
- />
- <AiSentimentHorizontalBar
- @type="neutral"
- @score={{data.score_map.neutral}}
- @width={{data.widths.neutral}}
- />
- </td>
- </tr>
- {{/each}}
- </tbody>
- </table>
- {{else}}
- <div class="admin-report-sentiment-analysis">
- <table class="sentiment-analysis-table md-table">
- <thead>
- <th>{{this.groupingType}}</th>
- <th>{{i18n
- "discourse_ai.sentiments.sentiment_analysis.table.total_count"
- }}</th>
- <th>{{i18n
- "discourse_ai.sentiments.sentiment_analysis.table.sentiment"
- }}</th>
- </thead>
-
- <tbody>
- {{#each this.transformedData as |data|}}
- <tr
- class="sentiment-analysis-table__row"
- role="button"
- {{on "click" (fn this.showDetails data)}}
- >
- <td class="sentiment-analysis-table__title">
- {{#if data.category}}
- {{dCategoryBadge data.category}}
- {{else}}
- {{data.title}}
- {{/if}}
- </td>
- <td
- class="sentiment-analysis-table__total-score"
- >{{data.total_score}}</td>
- <td class="sentiment-horizontal-bar">
- <AiSentimentHorizontalBar
- @type="positive"
- @score={{data.score_map.positive}}
- @width={{data.widths.positive}}
- />
- <AiSentimentHorizontalBar
- @type="negative"
- @score={{data.score_map.negative}}
- @width={{data.widths.negative}}
- />
- <AiSentimentHorizontalBar
- @type="neutral"
- @score={{data.score_map.neutral}}
- @width={{data.widths.neutral}}
- />
- </td>
- </tr>
- {{/each}}
- </tbody>
- </table>
- </div>
- {{/if}}
+ <table class="sentiment-analysis-table md-table">
+ <thead>
+ <th>{{this.groupingType}}</th>
+ <th>{{i18n
+ "discourse_ai.sentiments.sentiment_analysis.table.total_count"
+ }}</th>
+ <th>{{i18n
+ "discourse_ai.sentiments.sentiment_analysis.table.sentiment"
+ }}</th>
+ </thead>
+
+ <tbody>
+ {{#each this.transformedData as |data|}}
+ <tr
+ class="sentiment-analysis-table__row"
+ role="button"
+ {{on "click" (fn this.showDetails data)}}
+ >
+ <td class="sentiment-analysis-table__title">
+ {{#if data.category}}
+ {{dCategoryBadge data.category}}
+ {{else}}
+ {{data.title}}
+ {{/if}}
+ </td>
+ <td
+ class="sentiment-analysis-table__total-score"
+ >{{data.total_score}}</td>
+ <td class="sentiment-horizontal-bar">
+ <AiSentimentHorizontalBar
+ @type="positive"
+ @score={{data.score_map.positive}}
+ @width={{data.widths.positive}}
+ />
+ <AiSentimentHorizontalBar
+ @type="negative"
+ @score={{data.score_map.negative}}
+ @width={{data.widths.negative}}
+ />
+ <AiSentimentHorizontalBar
+ @type="neutral"
+ @score={{data.score_map.neutral}}
+ @width={{data.widths.neutral}}
+ />
+ </td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
{{/unless}}
{{#if (and this.selectedChart this.showingSelectedChart)}}
diff --git a/spec/jobs/export_csv_file_spec.rb b/spec/jobs/export_csv_file_spec.rb
index e6a4810488d..de76ec8e331 100644
--- a/spec/jobs/export_csv_file_spec.rb
+++ b/spec/jobs/export_csv_file_spec.rb
@@ -233,14 +233,14 @@ RSpec.describe Jobs::ExportCsvFile do
report = export_report
expect(report.length).to eq(2)
- expect(report.first).to contain_exactly("Day", "Count")
- expect(report.second).to contain_exactly("2010-01-03", "1")
+ expect(report.first).to contain_exactly("Day", "Desktop", "Mobile")
+ expect(report.second).to contain_exactly("2010-01-03", "1", "")
end
it "works with single-column reports with default label" do
- user.user_visits.create!(visited_at: "2010-01-01")
- Fabricate(:user).user_visits.create!(visited_at: "2010-01-03")
- exporter.extra["name"] = "visits"
+ user.user_visits.create!(visited_at: "2010-01-01", mobile: true)
+ Fabricate(:user).user_visits.create!(visited_at: "2010-01-03", mobile: true)
+ exporter.extra["name"] = "mobile_visits"
report = export_report
diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rb
index eb73c88d451..9b507458431 100644
--- a/spec/models/report_spec.rb
+++ b/spec/models/report_spec.rb
@@ -156,26 +156,6 @@ RSpec.describe Report do
include_examples "no data"
context "with visits" do
- let(:user) { Fabricate(:user) }
-
- it "returns a report with data" do
- freeze_time_safe
- user.user_visits.create(visited_at: 1.hour.from_now)
- user.user_visits.create(visited_at: 1.day.ago)
- user.user_visits.create(visited_at: 2.days.ago, mobile: true)
- user.user_visits.create(visited_at: 45.days.ago)
- user.user_visits.create(visited_at: 46.days.ago, mobile: true)
-
- expect(report.data).to be_present
- expect(report.data.count).to eq(3)
- expect(report.data.select { |v| v[:x].today? }).to be_present
- expect(report.prev30Days).to eq(2)
- end
- end
-
- context "when reporting_improvements is enabled" do
- before { SiteSetting.reporting_improvements = true }
-
fab!(:user)
fab!(:user_2, :user)
diff --git a/spec/queries/reports/list_query_spec.rb b/spec/queries/reports/list_query_spec.rb
index fa353fd8fdf..cdc40eebd06 100644
--- a/spec/queries/reports/list_query_spec.rb
+++ b/spec/queries/reports/list_query_spec.rb
@@ -28,15 +28,14 @@ RSpec.describe Reports::ListQuery do
end
it "sorts reports by title" do
- expect(result.map { |r| r[:title] }[0..6]).to eq(
+ expect(result.map { |r| r[:title] }[0..5]).to eq(
[
I18n.t("reports.activity_by_category.title"),
I18n.t("reports.admin_logins.title"),
I18n.t("reports.page_view_anon_browser_reqs.title"),
- I18n.t("reports.associated_accounts_by_provider.title"),
- I18n.t("reports.bookmarks.title"),
- I18n.t("reports.consolidated_api_requests.title"),
I18n.t("reports.dau_by_mau.title"),
+ I18n.t("reports.daily_engaged_users.title"),
+ I18n.t("reports.emails.title"),
],
)
end
@@ -108,74 +107,57 @@ RSpec.describe Reports::ListQuery do
end
end
- context "when reporting_improvements is enabled" do
- before { SiteSetting.reporting_improvements = true }
-
- it "sorts reports by title" do
- expect(result.map { |r| r[:title] }[0..5]).to eq(
- [
- I18n.t("reports.activity_by_category.title"),
- I18n.t("reports.admin_logins.title"),
- I18n.t("reports.page_view_anon_browser_reqs.title"),
- I18n.t("reports.dau_by_mau.title"),
- I18n.t("reports.daily_engaged_users.title"),
- I18n.t("reports.emails.title"),
- ],
- )
- end
-
- it "excludes legacy reports" do
- report_types = result.map { |r| r[:type] }
- expect(report_types).not_to include(*Report::LEGACY_REPORTS)
- end
+ it "excludes legacy reports" do
+ report_types = result.map { |r| r[:type] }
+ expect(report_types).not_to include(*Report::LEGACY_REPORTS)
+ end
- it "does not include plugin name for core reports" do
- topics_report = result.find { |r| r[:type] == "topics" }
- expect(topics_report[:plugin]).to be_nil
- end
+ it "does not include plugin name for core reports" do
+ topics_report = result.find { |r| r[:type] == "topics" }
+ expect(topics_report[:plugin]).to be_nil
+ end
- context "with a plugin report" do
- let(:plugin) { Plugin::Instance.new }
+ context "with a plugin report" do
+ let(:plugin) { Plugin::Instance.new }
- before do
- Report.add_report("test_plugin_report") { |report| }
- Discourse.plugins_by_name["test-plugin"] = plugin
+ before do
+ Report.add_report("test_plugin_report") { |report| }
+ Discourse.plugins_by_name["test-plugin"] = plugin
- I18n.backend.store_translations(
- :en,
- { reports: { test_plugin_report: { title: "Test Plugin Report" } } },
- )
- end
+ I18n.backend.store_translations(
+ :en,
+ { reports: { test_plugin_report: { title: "Test Plugin Report" } } },
+ )
+ end
- after do
- if Report.singleton_class.method_defined?(:report_test_plugin_report)
- Report.singleton_class.remove_method(:report_test_plugin_report)
- end
- Discourse.plugins_by_name.delete("test-plugin")
+ after do
+ if Report.singleton_class.method_defined?(:report_test_plugin_report)
+ Report.singleton_class.remove_method(:report_test_plugin_report)
end
+ Discourse.plugins_by_name.delete("test-plugin")
+ end
- it "is not visible when the source plugin is disabled" do
- plugin.stubs(:enabled?).returns(false)
+ it "is not visible when the source plugin is disabled" do
+ plugin.stubs(:enabled?).returns(false)
- formatted = Reports::ListQuery::FormattedReport.new(:report_test_plugin_report)
- formatted.stubs(:resolve_plugin_name).returns("test-plugin")
+ formatted = Reports::ListQuery::FormattedReport.new(:report_test_plugin_report)
+ formatted.stubs(:resolve_plugin_name).returns("test-plugin")
- expect(formatted.visible?(guardian: admin_guardian)).to eq(false)
- end
+ expect(formatted.visible?(guardian: admin_guardian)).to eq(false)
+ end
- it "is visible when the source plugin is enabled" do
- plugin.stubs(:enabled?).returns(true)
- plugin.stubs(:humanized_name).returns("Test Plugin")
+ it "is visible when the source plugin is enabled" do
+ plugin.stubs(:enabled?).returns(true)
+ plugin.stubs(:humanized_name).returns("Test Plugin")
- formatted = Reports::ListQuery::FormattedReport.new(:report_test_plugin_report)
- formatted.stubs(:resolve_plugin_name).returns("test-plugin")
+ formatted = Reports::ListQuery::FormattedReport.new(:report_test_plugin_report)
+ formatted.stubs(:resolve_plugin_name).returns("test-plugin")
- expect(formatted.visible?(guardian: admin_guardian)).to eq(true)
+ expect(formatted.visible?(guardian: admin_guardian)).to eq(true)
- result = formatted.to_h
- expect(result[:plugin]).to eq("test-plugin")
- expect(result[:plugin_display_name]).to eq("Test Plugin")
- end
+ result = formatted.to_h
+ expect(result[:plugin]).to eq("test-plugin")
+ expect(result[:plugin_display_name]).to eq("Test Plugin")
end
end
end
diff --git a/spec/requests/admin/reports_controller_spec.rb b/spec/requests/admin/reports_controller_spec.rb
index 45e926a92c6..d42522da030 100644
--- a/spec/requests/admin/reports_controller_spec.rb
+++ b/spec/requests/admin/reports_controller_spec.rb
@@ -26,16 +26,6 @@ RSpec.describe Admin::ReportsController do
*Report::ADMIN_ONLY_REPORTS,
)
end
-
- it "includes suspicious logins when IP viewing is disabled" do
- SiteSetting.moderators_view_ips = false
-
- get "/admin/reports.json"
-
- expect(response.parsed_body["reports"].map { |r| r["type"] }).to include(
- "suspicious_logins",
- )
- end
end
before { sign_in(admin) }
diff --git a/spec/system/admin_dashboard_general_spec.rb b/spec/system/admin_dashboard_general_spec.rb
index dd2adf3accc..574c0a3d144 100644
--- a/spec/system/admin_dashboard_general_spec.rb
+++ b/spec/system/admin_dashboard_general_spec.rb
@@ -9,31 +9,12 @@ describe "Admin Dashboard General Tab" do
before { sign_in(admin) }
- context "when reporting_improvements is enabled" do
- before { SiteSetting.reporting_improvements = true }
+ it "displays correct visit counters combining desktop and mobile visits" do
+ visit("/admin")
- it "displays correct visit counters combining desktop and mobile visits" do
- visit("/admin")
-
- screenshot_marker(label: "admin-dashboard")
-
- within ".admin-report.visits .admin-report-counters" do
- expect(page).to have_css(".today-count", text: "2")
- expect(page).to have_css(".yesterday-count", text: "1")
- end
- end
- end
-
- context "when reporting_improvements is disabled" do
- before { SiteSetting.reporting_improvements = false }
-
- it "displays correct visit counters" do
- visit("/admin")
-
- within ".admin-report.visits .admin-report-counters" do
- expect(page).to have_css(".today-count", text: "2")
- expect(page).to have_css(".yesterday-count", text: "1")
- end
+ within ".admin-report.visits .admin-report-counters" do
+ expect(page).to have_css(".today-count", text: "2")
+ expect(page).to have_css(".yesterday-count", text: "1")
end
end
end
diff --git a/spec/system/admin_reports_spec.rb b/spec/system/admin_reports_spec.rb
index dc65725f408..c9c4e1c6c1b 100644
--- a/spec/system/admin_reports_spec.rb
+++ b/spec/system/admin_reports_spec.rb
@@ -22,23 +22,27 @@ describe "Admin Reports" do
end
end
- context "with legacy reports" do
- before { SiteSetting.reporting_improvements = true }
- it "does not list bookmarks on the index page but allows direct access with a warning" do
- visit "/admin/reports"
+ it "groups reports under headings, hides legacy reports from the index, and warns on direct access" do
+ visit "/admin/reports"
- expect(page).to have_no_css(
- ".admin-section-landing-item__title",
- text: I18n.t("reports.bookmarks.title"),
- )
-
- visit "/admin/reports/bookmarks"
-
- expect(page).to have_css(".admin-report")
+ within(".admin-reports-group", text: "Engagement") do
expect(page).to have_css(
- ".alert.alert-info",
- text: I18n.t("admin_js.admin.reports.legacy_warning"),
+ ".admin-section-landing-item__title",
+ text: I18n.t("reports.signups.title"),
)
end
+ expect(page).to have_css(".admin-reports-group__title", text: "Traffic")
+ expect(page).to have_no_css(
+ ".admin-section-landing-item__title",
+ text: I18n.t("reports.bookmarks.title"),
+ )
+
+ visit "/admin/reports/bookmarks"
+
+ expect(page).to have_css(".admin-report")
+ expect(page).to have_css(
+ ".alert.alert-info",
+ text: I18n.t("admin_js.admin.reports.legacy_warning"),
+ )
end
end
diff --git a/themes/horizon/scss/misc.scss b/themes/horizon/scss/misc.scss
index e09ddd5c14b..1c41a0cbcd1 100644
--- a/themes/horizon/scss/misc.scss
+++ b/themes/horizon/scss/misc.scss
@@ -23,8 +23,8 @@
background-color: transparent;
}
-.admin-report .main .report-alert.no-data,
-.admin-report .main .report-alert.rate-limited {
+.admin-report .chart__body .report-alert.no-data,
+.admin-report .chart__body .report-alert.rate-limited {
background-color: var(--d-content-background);
}