diff --git a/models/pull.go b/models/pull.go
index 3f89088192..13518dd1c3 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -339,14 +339,17 @@ func (pr *PullRequest) GetLastCommitStatus() (status *CommitStatus, err error) {
return nil, err
}
- repo := pr.HeadRepo
lastCommitID, err := headGitRepo.GetBranchCommitID(pr.HeadBranch)
if err != nil {
return nil, err
}
- var statusList []*CommitStatus
- statusList, err = GetLatestCommitStatus(repo, lastCommitID, 0)
+ err = pr.GetBaseRepo()
+ if err != nil {
+ return nil, err
+ }
+
+ statusList, err := GetLatestCommitStatus(pr.BaseRepo, lastCommitID, 0)
if err != nil {
return nil, err
}
diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl
index 3007c99106..ac32a8d71e 100644
--- a/templates/repo/issue/list.tmpl
+++ b/templates/repo/issue/list.tmpl
@@ -212,8 +212,8 @@
{{.Title}}
{{if .IsPull }}
- {{if (index $.CommitStatus .ID)}}
- {{template "repo/commit_status" (index $.CommitStatus .ID)}}
+ {{if (index $.CommitStatus .PullRequest.ID)}}
+ {{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}}
{{end}}
{{end}}
diff --git a/templates/user/dashboard/issues.tmpl b/templates/user/dashboard/issues.tmpl
index b69509d799..deb6ec6512 100644
--- a/templates/user/dashboard/issues.tmpl
+++ b/templates/user/dashboard/issues.tmpl
@@ -68,8 +68,8 @@
{{.Title}}
{{if .IsPull }}
- {{if (index $.CommitStatus .ID)}}
- {{template "repo/commit_status" (index $.CommitStatus .ID)}}
+ {{if (index $.CommitStatus .PullRequest.ID)}}
+ {{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}}
{{end}}
{{end}}