aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXinyu Zhou <its@baronbunny.cn>2022-10-27 12:34:32 +0800
committerGitHub <noreply@github.com>2022-10-27 12:34:32 +0800
commit43a8547df6e3a186b3b8430cd9856f612047a50a (patch)
tree0dce355b14e25f23a7f654d44616992c2fde918f
parent291787a5efaa2352241a25bcd75ff69eac23c4f0 (diff)
downloadgitea-43a8547df6e3a186b3b8430cd9856f612047a50a.tar.gz
gitea-43a8547df6e3a186b3b8430cd9856f612047a50a.zip
Added check for disabled Packages (#21540) (#21614)
Backport #21540 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.
-rw-r--r--routers/web/web.go2
-rw-r--r--templates/admin/navbar.tmpl8
2 files changed, 7 insertions, 3 deletions
diff --git a/routers/web/web.go b/routers/web/web.go
index b604337715..e4fea38244 100644
--- a/routers/web/web.go
+++ b/routers/web/web.go
@@ -566,6 +566,8 @@ func RegisterRoutes(m *web.Route) {
m.Post("/delete", admin.DeleteNotices)
m.Post("/empty", admin.EmptyNotices)
})
+ }, func(ctx *context.Context) {
+ ctx.Data["EnablePackages"] = setting.Packages.Enabled
}, adminReq)
// ***** END: Admin *****
diff --git a/templates/admin/navbar.tmpl b/templates/admin/navbar.tmpl
index 24a0a093a6..e523da7e7a 100644
--- a/templates/admin/navbar.tmpl
+++ b/templates/admin/navbar.tmpl
@@ -12,9 +12,11 @@
<a class="{{if .PageIsAdminRepositories}}active{{end}} item" href="{{AppSubUrl}}/admin/repos">
{{.i18n.Tr "admin.repositories"}}
</a>
- <a class="{{if .PageIsAdminPackages}}active{{end}} item" href="{{AppSubUrl}}/admin/packages">
- {{.i18n.Tr "packages.title"}}
- </a>
+ {{if .EnablePackages}}
+ <a class="{{if .PageIsAdminPackages}}active{{end}} item" href="{{AppSubUrl}}/admin/packages">
+ {{.i18n.Tr "packages.title"}}
+ </a>
+ {{end}}
{{if not DisableWebhooks}}
<a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active{{end}} item" href="{{AppSubUrl}}/admin/hooks">
{{.i18n.Tr "admin.hooks"}}