diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-05-09 07:30:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-09 01:30:14 +0200 |
commit | def4956122ea2364f247712b13856383ee496add (patch) | |
tree | 311e7a077aba83825815881b7bf35fff28930533 /modules/context/context.go | |
parent | c4303efc23ea19f16ee826809f43888ee4583ebb (diff) | |
download | gitea-def4956122ea2364f247712b13856383ee496add.tar.gz gitea-def4956122ea2364f247712b13856383ee496add.zip |
Improve Gitea's web context, decouple "issue template" code into service package (#24590)
1. Remove unused fields/methods in web context.
2. Make callers call target function directly instead of the light
wrapper like "IsUserRepoReaderSpecific"
3. The "issue template" code shouldn't be put in the "modules/context"
package, so move them to the service package.
---------
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'modules/context/context.go')
-rw-r--r-- | modules/context/context.go | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/modules/context/context.go b/modules/context/context.go index 3e1b48dcde..9ba1985f36 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -36,19 +36,20 @@ type Render interface { // Context represents context of a request. type Context struct { - Resp ResponseWriter - Req *http.Request + Resp ResponseWriter + Req *http.Request + Render Render + Data middleware.ContextData // data used by MVC templates PageData map[string]any // data used by JavaScript modules in one page, it's `window.config.pageData` - Render Render - Locale translation.Locale - Cache cache.Cache - Csrf CSRFProtector - Flash *middleware.Flash - Session session.Store - - Link string // current request URL - EscapedLink string + + Locale translation.Locale + Cache cache.Cache + Csrf CSRFProtector + Flash *middleware.Flash + Session session.Store + + Link string // current request URL (without query string) Doer *user_model.User IsSigned bool IsBasicAuth bool |