From b4d54b3e8f27df45f2324aceb3a2270b3fe9cb8a Mon Sep 17 00:00:00 2001 From: jolheiser Date: Fri, 13 Dec 2019 09:12:19 -0600 Subject: [PATCH] Fix protected branch using IssueID Signed-off-by: jolheiser --- models/branches.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/branches.go b/models/branches.go index cf4b4fe393205..bb99cffa05330 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))