Skip to content

Commit

Permalink
Added check for disabled Packages (#21540)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rock2dust authored Oct 22, 2022
1 parent 1887c95 commit cd33979
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions routers/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 *****

Expand Down
8 changes: 5 additions & 3 deletions templates/admin/navbar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
<a class="{{if .PageIsAdminRepositories}}active{{end}} item" href="{{AppSubUrl}}/admin/repos">
{{.locale.Tr "admin.repositories"}}
</a>
<a class="{{if .PageIsAdminPackages}}active{{end}} item" href="{{AppSubUrl}}/admin/packages">
{{.locale.Tr "packages.title"}}
</a>
{{if .EnablePackages}}
<a class="{{if .PageIsAdminPackages}}active{{end}} item" href="{{AppSubUrl}}/admin/packages">
{{.locale.Tr "packages.title"}}
</a>
{{end}}
{{if not DisableWebhooks}}
<a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active{{end}} item" href="{{AppSubUrl}}/admin/hooks">
{{.locale.Tr "admin.hooks"}}
Expand Down

0 comments on commit cd33979

Please sign in to comment.