aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElias Norberg2019-10-01 19:16:45 +0200
committerAntoine GIRARD2019-10-01 19:16:45 +0200
commite90d88d5d5d12f17b1d58ca738d4678997833873 (patch)
treeb312585c9593009df2d751bd767971e11ea47f4d
parent7156e2a71aa97565927df83df78d384b84de929e (diff)
Backport of commit status fixes in PR #8316 and PR #8321 to v1.9 (#8339)
* Use correct index when fetching commit status Signed-off-by: Elias Norberg <elias@aisle.se> * Compare against base repo to avoid mismatch when merging from fork Signed-off-by: Elias Norberg <elias@aisle.se> * Fix pull request commit status in user dashboard list
-rw-r--r--models/pull.go9
-rw-r--r--templates/repo/issue/list.tmpl4
-rw-r--r--templates/user/dashboard/issues.tmpl4
3 files changed, 10 insertions, 7 deletions
diff --git a/models/pull.go b/models/pull.go
index 3f8908819..13518dd1c 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 3007c9910..ac32a8d71 100644
--- a/templates/repo/issue/list.tmpl
+++ b/templates/repo/issue/list.tmpl
@@ -212,8 +212,8 @@
<a class="title has-emoji" href="{{$.Link}}/{{.Index}}">{{.Title}}</a>
{{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 b69509d79..deb6ec651 100644
--- a/templates/user/dashboard/issues.tmpl
+++ b/templates/user/dashboard/issues.tmpl
@@ -68,8 +68,8 @@
<a class="title has-emoji" href="{{AppSubUrl}}/{{.Repo.Owner.Name}}/{{.Repo.Name}}/issues/{{.Index}}">{{.Title}}</a>
{{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}}