From c335d076aac313b4534bb47bbbb6259325174ff7 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 4 Feb 2024 09:43:59 +0100 Subject: [PATCH] [GITEA] 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 (cherry picked from commit 0ca118fdc3c39c0e7adf9285e074e5878a0ca1c1) --- 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 c3293ba7f..6d390fdd1 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 fa79f0f75..f23bdee12 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"}}