From 641d6cda2d5dc174d0f5f27d7439c21c6aa836e8 Mon Sep 17 00:00:00 2001 From: baronbunny Date: Sat, 22 Oct 2022 10:07:42 +0800 Subject: [PATCH] Added check for disabled Packages At the moment, If admin disable Packages, still show the Packages on the admin dashboard This patch added a check to hide the Packages entry Signed-off-by: baronbunny --- routers/web/web.go | 1 + templates/admin/navbar.tmpl | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/routers/web/web.go b/routers/web/web.go index 62503b3141e8d..9b814c3f54246 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -591,6 +591,7 @@ func RegisterRoutes(m *web.Route) { }) }, func(ctx *context.Context) { ctx.Data["EnableOAuth2"] = setting.OAuth2.Enable + ctx.Data["EnablePackages"] = setting.Packages.Enabled }, adminReq) // ***** END: Admin ***** diff --git a/templates/admin/navbar.tmpl b/templates/admin/navbar.tmpl index b138eb79ba4ee..1c8b12fc2fafc 100644 --- a/templates/admin/navbar.tmpl +++ b/templates/admin/navbar.tmpl @@ -12,9 +12,11 @@ {{.locale.Tr "admin.repositories"}} - - {{.locale.Tr "packages.title"}} - + {{if .EnablePackages}} + + {{.locale.Tr "packages.title"}} + + {{end}} {{if not DisableWebhooks}} {{.locale.Tr "admin.hooks"}}