Skip to content

Commit 49547ea

Browse files
yzzyxlunny
authored andcommitted
Show correct commit status in PR list (#8316)
* Use correct index when fetching commit status Signed-off-by: Elias Norberg <[email protected]> * Compare against base repo to avoid mismatch when merging from fork Signed-off-by: Elias Norberg <[email protected]>
1 parent 9c2a584 commit 49547ea

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

models/pull.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,17 @@ func (pr *PullRequest) GetLastCommitStatus() (status *CommitStatus, err error) {
353353
return nil, err
354354
}
355355

356-
repo := pr.HeadRepo
357356
lastCommitID, err := headGitRepo.GetBranchCommitID(pr.HeadBranch)
358357
if err != nil {
359358
return nil, err
360359
}
361360

362-
var statusList []*CommitStatus
363-
statusList, err = GetLatestCommitStatus(repo, lastCommitID, 0)
361+
err = pr.LoadBaseRepo()
362+
if err != nil {
363+
return nil, err
364+
}
365+
366+
statusList, err := GetLatestCommitStatus(pr.BaseRepo, lastCommitID, 0)
364367
if err != nil {
365368
return nil, err
366369
}

templates/repo/issue/list.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@
212212
<a class="title has-emoji" href="{{$.Link}}/{{.Index}}">{{.Title}}</a>
213213

214214
{{if .IsPull }}
215-
{{if (index $.CommitStatus .ID)}}
216-
{{template "repo/commit_status" (index $.CommitStatus .ID)}}
215+
{{if (index $.CommitStatus .PullRequest.ID)}}
216+
{{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}}
217217
{{end}}
218218
{{end}}
219219

0 commit comments

Comments
 (0)