Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-28 04:36:11 +01:00

Fix the route for pull-request's authors (#26016) (#26018)

Backport #26016 by @wxiaoguang

Close #25906

![image](https://github.com/go-gitea/gitea/assets/2114189/e689f3e1-9a90-46c0-89f4-2d61394d34d3)

Succeeded logs:

```
[I] router: completed GET /root/test/issues/posters?&q=%20&_=1689853025011 for [::1]:59271, 200 OK in 127.7ms @ repo/issue.go:3505(repo.IssuePosters)

[I] router: completed GET /root/test/pulls/posters?&q=%20&_=1689853968204 for [::1]:59269, 200 OK in 94.3ms @ repo/issue.go:3509(repo.PullPosters)
```

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 54a516e9da)
This commit is contained in:
Giteabot 2023-07-20 09:38:12 -04:00 committed by Earl Warren
parent 9a3778b230
commit 884f2c125c
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 11 additions and 5 deletions

View file

@ -3479,8 +3479,15 @@ type userSearchResponse struct {
// IssuePosters get posters for current repo's issues/pull requests // IssuePosters get posters for current repo's issues/pull requests
func IssuePosters(ctx *context.Context) { func IssuePosters(ctx *context.Context) {
issuePosters(ctx, false)
}
func PullPosters(ctx *context.Context) {
issuePosters(ctx, true)
}
func issuePosters(ctx *context.Context, isPullList bool) {
repo := ctx.Repo.Repository repo := ctx.Repo.Repository
isPullList := ctx.Params(":type") == "pulls"
search := strings.TrimSpace(ctx.FormString("q")) search := strings.TrimSpace(ctx.FormString("q"))
posters, err := repo_model.GetIssuePostersWithSearch(ctx, repo, isPullList, search, setting.UI.DefaultShowFullName) posters, err := repo_model.GetIssuePostersWithSearch(ctx, repo, isPullList, search, setting.UI.DefaultShowFullName)
if err != nil { if err != nil {

View file

@ -1157,10 +1157,8 @@ func registerRoutes(m *web.Route) {
m.Group("/{username}/{reponame}", func() { m.Group("/{username}/{reponame}", func() {
m.Group("", func() { m.Group("", func() {
m.Group("/{type:issues|pulls}", func() { m.Get("/issues/posters", repo.IssuePosters) // it can't use {type:issues|pulls} because other routes like "/pulls/{index}" has higher priority
m.Get("", repo.Issues) m.Get("/{type:issues|pulls}", repo.Issues)
m.Get("/posters", repo.IssuePosters)
})
m.Get("/{type:issues|pulls}/{index}", repo.ViewIssue) m.Get("/{type:issues|pulls}/{index}", repo.ViewIssue)
m.Group("/{type:issues|pulls}/{index}/content-history", func() { m.Group("/{type:issues|pulls}/{index}/content-history", func() {
m.Get("/overview", repo.GetContentHistoryOverview) m.Get("/overview", repo.GetContentHistoryOverview)
@ -1281,6 +1279,7 @@ func registerRoutes(m *web.Route) {
return cancel return cancel
}) })
m.Get("/pulls/posters", repo.PullPosters)
m.Group("/pulls/{index}", func() { m.Group("/pulls/{index}", func() {
m.Get(".diff", repo.DownloadPullDiff) m.Get(".diff", repo.DownloadPullDiff)
m.Get(".patch", repo.DownloadPullPatch) m.Get(".patch", repo.DownloadPullPatch)