diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-06-18 08:51:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-18 00:51:13 +0000 |
commit | 37a4b233a0a4ca516b90e0c8e15d8dafb8d13358 (patch) | |
tree | 906fc88c06e46d164157707886833332aebcf5c8 /services/context | |
parent | d32648b204395fe3590ca2de5f38f0f97da510aa (diff) | |
download | gitea-37a4b233a0a4ca516b90e0c8e15d8dafb8d13358.tar.gz gitea-37a4b233a0a4ca516b90e0c8e15d8dafb8d13358.zip |
Refactor repo unit "disabled" check (#31389)
1. There are already global "unit consts", no need to use context data, which is fragile
2. Remove the "String()" method from "unit", it would only cause rendering problems in templates
---------
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'services/context')
-rw-r--r-- | services/context/context.go | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/services/context/context.go b/services/context/context.go index aab0485f1a..69b65cbddb 100644 --- a/services/context/context.go +++ b/services/context/context.go @@ -210,16 +210,9 @@ func Contexter() func(next http.Handler) http.Handler { // FIXME: do we really always need these setting? There should be someway to have to avoid having to always set these ctx.Data["DisableMigrations"] = setting.Repository.DisableMigrations ctx.Data["DisableStars"] = setting.Repository.DisableStars - ctx.Data["EnableActions"] = setting.Actions.Enabled + ctx.Data["EnableActions"] = setting.Actions.Enabled && !unit.TypeActions.UnitGlobalDisabled() ctx.Data["ManifestData"] = setting.ManifestData - - ctx.Data["UnitWikiGlobalDisabled"] = unit.TypeWiki.UnitGlobalDisabled() - ctx.Data["UnitIssuesGlobalDisabled"] = unit.TypeIssues.UnitGlobalDisabled() - ctx.Data["UnitPullsGlobalDisabled"] = unit.TypePullRequests.UnitGlobalDisabled() - ctx.Data["UnitProjectsGlobalDisabled"] = unit.TypeProjects.UnitGlobalDisabled() - ctx.Data["UnitActionsGlobalDisabled"] = unit.TypeActions.UnitGlobalDisabled() - ctx.Data["AllLangs"] = translation.AllLangs() next.ServeHTTP(ctx.Resp, ctx.Req) |