diff options
author | Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> | 2020-12-18 13:37:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-18 13:37:55 +0100 |
commit | efa9a8a6e308489cf5b5e0174007d78390c5f0e6 (patch) | |
tree | 945e91e4bbe71b65f96012b6011d842a855c8f54 /routers/repo | |
parent | 48bd02e753bf4bfe2d743ffed8ec05182f284ad0 (diff) | |
download | gitea-efa9a8a6e308489cf5b5e0174007d78390c5f0e6.tar.gz gitea-efa9a8a6e308489cf5b5e0174007d78390c5f0e6.zip |
Show status check for merged PRs (#13975)
* Show status check for merged PRs
* Handle PRs with no commits
* Styling
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'routers/repo')
-rw-r--r-- | routers/repo/pull.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/routers/repo/pull.go b/routers/repo/pull.go index bee3bbc1df..901a668632 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -325,6 +325,20 @@ func PrepareMergedViewPullInfo(ctx *context.Context, issue *models.Issue) *git.C } ctx.Data["NumCommits"] = compareInfo.Commits.Len() ctx.Data["NumFiles"] = compareInfo.NumFiles + + if compareInfo.Commits.Len() != 0 { + sha := compareInfo.Commits.Front().Value.(*git.Commit).ID.String() + commitStatuses, err := models.GetLatestCommitStatus(ctx.Repo.Repository.ID, sha, models.ListOptions{}) + if err != nil { + ctx.ServerError("GetLatestCommitStatus", err) + return nil + } + if len(commitStatuses) != 0 { + ctx.Data["LatestCommitStatuses"] = commitStatuses + ctx.Data["LatestCommitStatus"] = models.CalcCommitStatus(commitStatuses) + } + } + return compareInfo } |