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>
This commit is contained in:
parent
48bd02e753
commit
efa9a8a6e3
3 changed files with 41 additions and 28 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue