DEV: Database backed admin notices (#26192)

This PR introduces a basic AdminNotice model to store these notices. Admin notices are categorized by their source/type (currently only notices from problem check.) They also have a priority.
This commit is contained in:
Ted Johansson
2024-05-23 09:29:08 +08:00
committed by GitHub
parent 7e8e803785
commit 3137e60653
55 changed files with 512 additions and 264 deletions

View File

@ -6,24 +6,6 @@ RSpec.describe AdminDashboardData do
Discourse.redis.flushdb
end
describe "#fetch_problems" do
describe "adding problem messages" do
it "adds the message and returns it when the problems are fetched" do
AdminDashboardData.add_problem_message("dashboard.bad_favicon_url")
problems = AdminDashboardData.fetch_problems.map(&:to_s)
expect(problems).to include(
I18n.t("dashboard.bad_favicon_url", { base_path: Discourse.base_path }),
)
end
it "does not allow adding of arbitrary problem messages, they must exist in AdminDashboardData.problem_messages" do
AdminDashboardData.add_problem_message("errors.messages.invalid")
problems = AdminDashboardData.fetch_problems.map(&:to_s)
expect(problems).not_to include(I18n.t("errors.messages.invalid"))
end
end
end
describe "adding scheduled checks" do
it "does not add duplicate problems with the same identifier" do
prob1 = ProblemCheck::Problem.new("test problem", identifier: "test")