Skip to content

Commit cd33979

Browse files
author
rock2dust
authored
Added check for disabled Packages (#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 Signed-off-by: baronbunny <its@baronbunny.cn> Signed-off-by: baronbunny <its@baronbunny.cn>
1 parent 1887c95 commit cd33979

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

routers/web/web.go

+1
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ func RegisterRoutes(m *web.Route) {
591591
})
592592
}, func(ctx *context.Context) {
593593
ctx.Data["EnableOAuth2"] = setting.OAuth2.Enable
594+
ctx.Data["EnablePackages"] = setting.Packages.Enabled
594595
}, adminReq)
595596
// ***** END: Admin *****
596597

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
{{.locale.Tr "admin.repositories"}}
1414
</a>
15-
<a class="{{if .PageIsAdminPackages}}active{{end}} item" href="{{AppSubUrl}}/admin/packages">
16-
{{.locale.Tr "packages.title"}}
17-
</a>
15+
{{if .EnablePackages}}
16+
<a class="{{if .PageIsAdminPackages}}active{{end}} item" href="{{AppSubUrl}}/admin/packages">
17+
{{.locale.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
{{.locale.Tr "admin.hooks"}}

0 commit comments

Comments
 (0)