mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 13:08:40 +08:00
This PR adds a "Site Advice" section to the redesigned admin dashboard that surfaces failing problem checks to staff. <img width="1079" height="463" alt="CleanShot 2026-06-23 at 11 26 54" src="https://github.com/user-attachments/assets/b1a2a4dd-cf34-4f11-8fc7-3a973d3e08db" /> --------- Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
72 lines
2.6 KiB
Ruby
Vendored
72 lines
2.6 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
describe "Admin Dashboard Redesign | Site Advice section" do
|
|
let(:dashboard) { PageObjects::Pages::AdminDashboard.new }
|
|
|
|
before { SiteSetting.dashboard_improvements = true }
|
|
|
|
context "when signed in as an admin" do
|
|
fab!(:current_user, :admin)
|
|
|
|
before { sign_in(current_user) }
|
|
|
|
it "shows every active problem with its count, severity order, and actions" do
|
|
dashboard.visit
|
|
|
|
expect(dashboard).to have_no_site_advice
|
|
|
|
Fabricate(:admin_notice, identifier: "host_names", priority: "low")
|
|
Fabricate(:admin_notice, identifier: "starttls_disabled", priority: "high")
|
|
|
|
dashboard.visit
|
|
|
|
expect(dashboard).to have_site_advice_at_top
|
|
expect(dashboard).to have_site_advice_title(
|
|
"2 issues require your attention based on your site configuration",
|
|
)
|
|
expect(dashboard).to have_first_site_advice_problem("STARTTLS disabled")
|
|
expect(dashboard).to have_site_advice_problem("default localhost hostname")
|
|
expect(dashboard).to have_ignore_button_for("STARTTLS disabled")
|
|
expect(dashboard).to have_ignore_button_for("default localhost hostname")
|
|
expect(dashboard).to have_site_advice_refresh_button
|
|
end
|
|
|
|
it "lets an admin ignore a problem and refresh the list in place" do
|
|
ProblemCheck.stubs(:realtime).returns(stub(run_all: nil))
|
|
|
|
Fabricate(:admin_notice, identifier: "host_names", priority: "low")
|
|
resolved = Fabricate(:admin_notice, identifier: "starttls_disabled", priority: "high")
|
|
|
|
dashboard.visit
|
|
dashboard.ignore_site_advice_problem("default localhost hostname")
|
|
|
|
expect(dashboard).to have_no_site_advice_problem("default localhost hostname")
|
|
|
|
resolved.destroy!
|
|
Fabricate(:admin_notice, identifier: "subfolder_ends_in_slash", priority: "low")
|
|
|
|
dashboard.refresh_site_advice
|
|
|
|
expect(dashboard).to have_no_site_advice_problem("default localhost hostname")
|
|
expect(dashboard).to have_no_site_advice_problem("STARTTLS disabled")
|
|
expect(dashboard).to have_site_advice_problem("subfolder setup is incorrect")
|
|
end
|
|
end
|
|
|
|
context "when signed in as a moderator" do
|
|
fab!(:moderator)
|
|
|
|
before { sign_in(moderator) }
|
|
|
|
it "shows the advice read-only, without any Ignore buttons" do
|
|
Fabricate(:admin_notice, identifier: "host_names", priority: "low")
|
|
|
|
dashboard.visit
|
|
|
|
expect(dashboard).to have_site_advice
|
|
expect(dashboard).to have_site_advice_problem("default localhost hostname")
|
|
expect(dashboard).to have_no_ignore_buttons
|
|
expect(dashboard).to have_site_advice_refresh_button
|
|
end
|
|
end
|
|
end
|