diff options
author | Elias Norberg <elias@aisle.se> | 2019-04-02 21:54:29 +0200 |
---|---|---|
committer | techknowlogick <matti@mdranta.net> | 2019-04-02 15:54:29 -0400 |
commit | bf5af87eef8913004df63aef58f71628f9c057d0 (patch) | |
tree | 9f49b1076a95d0ebc961a71a3ebb5d146c5d64c3 /routers | |
parent | 09fb036ad625ec5178319c30df47aac313fdbbe3 (diff) | |
download | gitea-bf5af87eef8913004df63aef58f71628f9c057d0.tar.gz gitea-bf5af87eef8913004df63aef58f71628f9c057d0.zip |
Show last commit status in pull request lists (#6465)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/issue.go | 8 | ||||
-rw-r--r-- | routers/user/home.go | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 45033e67c2..42f3ddf4e8 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -214,6 +214,8 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB } } + var commitStatus = make(map[int64]*models.CommitStatus, len(issues)) + // Get posters. for i := range issues { // Check read status @@ -223,8 +225,14 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB ctx.ServerError("GetIsRead", err) return } + + if isPullOption == util.OptionalBoolTrue { + commitStatus[issues[i].PullRequest.ID], _ = issues[i].PullRequest.GetLastCommitStatus() + } } + ctx.Data["Issues"] = issues + ctx.Data["CommitStatus"] = commitStatus // Get assignees. ctx.Data["Assignees"], err = repo.GetAssignees() diff --git a/routers/user/home.go b/routers/user/home.go index c4e169befd..740a9edc4e 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -319,8 +319,13 @@ func Issues(ctx *context.Context) { return } + var commitStatus = make(map[int64]*models.CommitStatus, len(issues)) for _, issue := range issues { issue.Repo = showReposMap[issue.RepoID] + + if isPullList { + commitStatus[issue.PullRequest.ID], _ = issue.PullRequest.GetLastCommitStatus() + } } issueStats, err := models.GetUserIssueStats(models.UserIssueStatsOptions{ @@ -344,6 +349,7 @@ func Issues(ctx *context.Context) { } ctx.Data["Issues"] = issues + ctx.Data["CommitStatus"] = commitStatus ctx.Data["Repos"] = showRepos ctx.Data["Counts"] = counts ctx.Data["Page"] = paginater.New(total, setting.UI.IssuePagingNum, page, 5) |