1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Prepare common tmpl functions in a middleware (#33957)

Fix the TODO in `routers/web/web.go`, and avoid the unnecessary
`GetActiveStopwatch` SQL query in non-related route handlers.
This commit is contained in:
wxiaoguang
2025-03-25 14:17:58 +08:00
committed by GitHub
parent 32258e0f22
commit 41c946a66f
6 changed files with 91 additions and 80 deletions

View File

@@ -280,10 +280,8 @@ func Routes() *web.Router {
routes.Get("/api/swagger", append(mid, misc.Swagger)...) // Render V1 by default
}
// TODO: These really seem like things that could be folded into Contexter or as helper functions
mid = append(mid, user.GetNotificationCount)
mid = append(mid, repo.GetActiveStopwatch)
mid = append(mid, goGet)
mid = append(mid, common.PageTmplFunctions)
others := web.NewRouter()
others.Use(mid...)