aboutsummaryrefslogtreecommitdiffstats
path: root/services/context/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/context/context.go')
-rw-r--r--services/context/context.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/services/context/context.go b/services/context/context.go
index 42f7c3d9d1..6c7128ef68 100644
--- a/services/context/context.go
+++ b/services/context/context.go
@@ -100,6 +100,7 @@ func NewTemplateContextForWeb(ctx *Context) TemplateContext {
tmplCtx := NewTemplateContext(ctx)
tmplCtx["Locale"] = ctx.Base.Locale
tmplCtx["AvatarUtils"] = templates.NewAvatarUtils(ctx)
+ tmplCtx["RenderUtils"] = templates.NewRenderUtils(ctx)
tmplCtx["RootData"] = ctx.Data
tmplCtx["Consts"] = map[string]any{
"RepoUnitTypeCode": unit.TypeCode,
@@ -154,7 +155,9 @@ func Contexter() func(next http.Handler) http.Handler {
ctx := NewWebContext(base, rnd, session.GetContextSession(req))
ctx.Data.MergeFrom(middleware.CommonTemplateContextData())
- ctx.Data["Context"] = ctx // TODO: use "ctx" in template and remove this
+ if setting.IsProd && !setting.IsInTesting {
+ ctx.Data["Context"] = ctx // TODO: use "ctx" in template and remove this
+ }
ctx.Data["CurrentURL"] = setting.AppSubURL + req.URL.RequestURI()
ctx.Data["Link"] = ctx.Link