mirror of
https://github.com/go-gitea/gitea.git
synced 2024-09-05 23:34:19 -04:00
Remove DataRaceCheck (#29258)
Since #26254, it started using `{{ctx.Locale.Tr ...}}` Now the `ctx` seems stable enough, so the check could be removed.
This commit is contained in:
parent
740c6a226c
commit
567a68a0bf
@ -5,10 +5,7 @@ package context
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ context.Context = TemplateContext(nil)
|
var _ context.Context = TemplateContext(nil)
|
||||||
@ -36,14 +33,3 @@ func (c TemplateContext) Err() error {
|
|||||||
func (c TemplateContext) Value(key any) any {
|
func (c TemplateContext) Value(key any) any {
|
||||||
return c.parentContext().Value(key)
|
return c.parentContext().Value(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DataRaceCheck checks whether the template context function "ctx()" returns the consistent context
|
|
||||||
// as the current template's rendering context (request context), to help to find data race issues as early as possible.
|
|
||||||
// When the code is proven to be correct and stable, this function should be removed.
|
|
||||||
func (c TemplateContext) DataRaceCheck(dataCtx context.Context) (string, error) {
|
|
||||||
if c.parentContext() != dataCtx {
|
|
||||||
log.Error("TemplateContext.DataRaceCheck: parent context mismatch\n%s", log.Stack(2))
|
|
||||||
return "", errors.New("parent context mismatch")
|
|
||||||
}
|
|
||||||
return "", nil
|
|
||||||
}
|
|
||||||
|
@ -16,6 +16,5 @@
|
|||||||
<script src="{{AssetUrlPrefix}}/js/index.js?v={{AssetVersion}}" onerror="alert('Failed to load asset files from ' + this.src + '. Please make sure the asset files can be accessed.')"></script>
|
<script src="{{AssetUrlPrefix}}/js/index.js?v={{AssetVersion}}" onerror="alert('Failed to load asset files from ' + this.src + '. Please make sure the asset files can be accessed.')"></script>
|
||||||
|
|
||||||
{{template "custom/footer" .}}
|
{{template "custom/footer" .}}
|
||||||
{{ctx.DataRaceCheck $.Context}}
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
{{template "custom/header" .}}
|
{{template "custom/header" .}}
|
||||||
</head>
|
</head>
|
||||||
<body hx-headers='{"x-csrf-token": "{{.CsrfToken}}"}' hx-swap="outerHTML" hx-ext="morph" hx-push-url="false">
|
<body hx-headers='{"x-csrf-token": "{{.CsrfToken}}"}' hx-swap="outerHTML" hx-ext="morph" hx-push-url="false">
|
||||||
{{ctx.DataRaceCheck $.Context}}
|
|
||||||
{{template "custom/body_outer_pre" .}}
|
{{template "custom/body_outer_pre" .}}
|
||||||
|
|
||||||
<div class="full height">
|
<div class="full height">
|
||||||
|
Loading…
Reference in New Issue
Block a user