Skip to content

Commit 43a8547

Browse files
author
Xinyu Zhou
authored
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.
1 parent 291787a commit 43a8547

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Diff for: routers/web/web.go

+2
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,8 @@ func RegisterRoutes(m *web.Route) {
566566
m.Post("/delete", admin.DeleteNotices)
567567
m.Post("/empty", admin.EmptyNotices)
568568
})
569+
}, func(ctx *context.Context) {
570+
ctx.Data["EnablePackages"] = setting.Packages.Enabled
569571
}, adminReq)
570572
// ***** END: Admin *****
571573

Diff for: templates/admin/navbar.tmpl

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
<a class="{{if .PageIsAdminRepositories}}active{{end}} item" href="{{AppSubUrl}}/admin/repos">
1313
{{.i18n.Tr "admin.repositories"}}
1414
</a>
15-
<a class="{{if .PageIsAdminPackages}}active{{end}} item" href="{{AppSubUrl}}/admin/packages">
16-
{{.i18n.Tr "packages.title"}}
17-
</a>
15+
{{if .EnablePackages}}
16+
<a class="{{if .PageIsAdminPackages}}active{{end}} item" href="{{AppSubUrl}}/admin/packages">
17+
{{.i18n.Tr "packages.title"}}
18+
</a>
19+
{{end}}
1820
{{if not DisableWebhooks}}
1921
<a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active{{end}} item" href="{{AppSubUrl}}/admin/hooks">
2022
{{.i18n.Tr "admin.hooks"}}

0 commit comments

Comments
 (0)