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 /routers/web/repo/view.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 'routers/web/repo/view.go')
-rw-r--r-- | routers/web/repo/view.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index 2bf293cbda..2fd893f91c 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -40,6 +40,7 @@ import ( "code.gitea.io/gitea/modules/typesniffer" "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/routers/web/feed" + issue_service "code.gitea.io/gitea/services/issue" "github.com/nektos/act/pkg/model" ) @@ -346,8 +347,8 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st if editorconfigErr != nil { ctx.Data["FileError"] = strings.TrimSpace(editorconfigErr.Error()) } - } else if ctx.Repo.IsIssueConfig(ctx.Repo.TreePath) { - _, issueConfigErr := ctx.Repo.GetIssueConfig(ctx.Repo.TreePath, ctx.Repo.Commit) + } else if issue_service.IsTemplateConfig(ctx.Repo.TreePath) { + _, issueConfigErr := issue_service.GetTemplateConfig(ctx.Repo.GitRepo, ctx.Repo.TreePath, ctx.Repo.Commit) if issueConfigErr != nil { ctx.Data["FileError"] = strings.TrimSpace(issueConfigErr.Error()) } |