From: John Olheiser <42128690+jolheiser@users.noreply.github.com> Date: Fri, 13 Dec 2019 15:37:10 +0000 (-0600) Subject: Fix protected branch using IssueID (#9348) X-Git-Tag: v1.11.0-rc1~161 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f09cdb239cb7e2d96c6bc9d5d43ada165b1240d1;p=gitea.git Fix protected branch using IssueID (#9348) Signed-off-by: jolheiser --- diff --git a/models/branches.go b/models/branches.go index cf4b4fe393..bb99cffa05 100644 --- a/models/branches.go +++ b/models/branches.go @@ -153,7 +153,7 @@ func (protectBranch *ProtectedBranch) HasEnoughApprovals(pr *PullRequest) bool { // GetGrantedApprovalsCount returns the number of granted approvals for pr. A granted approval must be authored by a user in an approval whitelist. func (protectBranch *ProtectedBranch) GetGrantedApprovalsCount(pr *PullRequest) int64 { - approvals, err := x.Where("issue_id = ?", pr.Issue.ID). + approvals, err := x.Where("issue_id = ?", pr.IssueID). And("type = ?", ReviewTypeApprove). And("official = ?", true). Count(new(Review))