From 0ca118fdc3c39c0e7adf9285e074e5878a0ca1c1 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 4 Feb 2024 09:43:59 +0100 Subject: [PATCH] admin: "Self Check" should only show for some db types The "Self Check" menu essentially runs the collation check that is also performed at startup, and displays the results. This is only a thing for MariaDB/MySQL and MSSQL. As such, the menu item should only be available for these database types. Signed-off-by: Gergely Nagy --- routers/web/web.go | 4 +++- templates/admin/navbar.tmpl | 2 ++ tests/integration/db_collation_test.go | 25 +++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/routers/web/web.go b/routers/web/web.go index f9611b5f4b..4b666faf63 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -676,7 +676,9 @@ func registerRoutes(m *web.Route) { m.Get("", admin.Dashboard) m.Post("", web.Bind(forms.AdminDashboardForm{}), admin.DashboardPost) - m.Get("/self_check", admin.SelfCheck) + if setting.Database.Type.IsMySQL() || setting.Database.Type.IsMSSQL() { + m.Get("/self_check", admin.SelfCheck) + } m.Group("/config", func() { m.Get("", admin.Config) diff --git a/templates/admin/navbar.tmpl b/templates/admin/navbar.tmpl index fa79f0f759..f23bdee124 100644 --- a/templates/admin/navbar.tmpl +++ b/templates/admin/navbar.tmpl @@ -4,9 +4,11 @@ {{ctx.Locale.Tr "admin.dashboard"}} + {{if or .DatabaseType.IsMySQL .DatabaseType.IsMSSQL}} {{ctx.Locale.Tr "admin.self_check"}} + {{end}}
{{ctx.Locale.Tr "admin.identity_access"}}