diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-03-04 13:50:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 13:50:55 +0800 |
commit | 4ef7e496b878911fd82f9036bde886ca725c4449 (patch) | |
tree | 8f446d086796fe2b091a35d0c109cea6b865e0c8 /modules | |
parent | b519e4750b9504ce7b89861e2ebe94edc8187372 (diff) | |
download | gitea-4ef7e496b878911fd82f9036bde886ca725c4449.tar.gz gitea-4ef7e496b878911fd82f9036bde886ca725c4449.zip |
Add a trailing slash to dashboard links (#29555) (#29573)
Backport #29555
Diffstat (limited to 'modules')
-rw-r--r-- | modules/contexttest/context_tests.go | 4 | ||||
-rw-r--r-- | modules/translation/mock.go | 4 | ||||
-rw-r--r-- | modules/translation/translation.go | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/modules/contexttest/context_tests.go b/modules/contexttest/context_tests.go index 97d912ea57..b9c1ab2964 100644 --- a/modules/contexttest/context_tests.go +++ b/modules/contexttest/context_tests.go @@ -12,6 +12,7 @@ import ( "net/url" "strings" "testing" + "time" access_model "code.gitea.io/gitea/models/perm/access" repo_model "code.gitea.io/gitea/models/repo" @@ -61,7 +62,8 @@ func MockContext(t *testing.T, reqPath string, opts ...MockContextOption) (*cont base.Locale = &translation.MockLocale{} ctx := context.NewWebContext(base, opt.Render, nil) - + ctx.PageData = map[string]any{} + ctx.Data["PageStartTime"] = time.Now() chiCtx := chi.NewRouteContext() ctx.Base.AppendContextValue(chi.RouteCtxKey, chiCtx) return ctx, resp diff --git a/modules/translation/mock.go b/modules/translation/mock.go index 2d0cb17324..d4c60e2517 100644 --- a/modules/translation/mock.go +++ b/modules/translation/mock.go @@ -6,7 +6,9 @@ package translation import "fmt" // MockLocale provides a mocked locale without any translations -type MockLocale struct{} +type MockLocale struct { + Lang, LangName string // these fields are used directly in templates: ctx.Locale.Lang +} var _ Locale = (*MockLocale)(nil) diff --git a/modules/translation/translation.go b/modules/translation/translation.go index dba4de6607..0acfe48c97 100644 --- a/modules/translation/translation.go +++ b/modules/translation/translation.go @@ -140,7 +140,7 @@ func Match(tags ...language.Tag) language.Tag { // locale represents the information of localization. type locale struct { i18n.Locale - Lang, LangName string // these fields are used directly in templates: .i18n.Lang + Lang, LangName string // these fields are used directly in templates: ctx.Locale.Lang msgPrinter *message.Printer } |