aboutsummaryrefslogtreecommitdiffstats
path: root/routers/install/install.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-05-23 09:29:15 +0800
committerGitHub <noreply@github.com>2023-05-23 09:29:15 +0800
commitabcf5a7b5e2c3df951b8048317a99a89b040b489 (patch)
tree46f089aec1c83dfa45e7e9ff18cbe4e508306cbb /routers/install/install.go
parent5c0745c0349f0709d0fc36fd8a97dcab86bce28a (diff)
downloadgitea-abcf5a7b5e2c3df951b8048317a99a89b040b489.tar.gz
gitea-abcf5a7b5e2c3df951b8048317a99a89b040b489.zip
Fix install page context, make the install page tests really test (#24858)
Fix #24856 Rename "context.contextKey" to "context.WebContextKey", this context is for web context only. But the Context itself is not renamed, otherwise it would cause a lot of changes (if we really want to rename it, there could be a separate PR). The old test code doesn't really test, the "install page" gets broken not only one time, so use new test code to make sure the "install page" could work.
Diffstat (limited to 'routers/install/install.go')
-rw-r--r--routers/install/install.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/install/install.go b/routers/install/install.go
index 89b91a5a48..4635cd7cb6 100644
--- a/routers/install/install.go
+++ b/routers/install/install.go
@@ -59,7 +59,7 @@ func Contexter() func(next http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
base, baseCleanUp := context.NewBaseContext(resp, req)
- ctx := context.Context{
+ ctx := &context.Context{
Base: base,
Flash: &middleware.Flash{},
Render: rnd,
@@ -67,6 +67,7 @@ func Contexter() func(next http.Handler) http.Handler {
}
defer baseCleanUp()
+ ctx.AppendContextValue(context.WebContextKey, ctx)
ctx.Data.MergeFrom(middleware.CommonTemplateContextData())
ctx.Data.MergeFrom(middleware.ContextData{
"locale": ctx.Locale,