diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2018-12-12 07:49:33 +0800 |
---|---|---|
committer | techknowlogick <hello@techknowlogick.com> | 2018-12-11 18:49:33 -0500 |
commit | b1f3685015246d3458f6d8c1d892eab076b3ed4a (patch) | |
tree | 4e909a78524095f0a34d8fe9ced2bdf86a6133e3 /routers/repo/issue.go | |
parent | 58c4559d3ba4a6b10e9bad3f84d53cc08edf7662 (diff) | |
download | gitea-b1f3685015246d3458f6d8c1d892eab076b3ed4a.tar.gz gitea-b1f3685015246d3458f6d8c1d892eab076b3ed4a.zip |
fix approvals limitation (#5521)
Diffstat (limited to 'routers/repo/issue.go')
-rw-r--r-- | routers/repo/issue.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index c04cc27746..e0fb4ac52f 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -776,6 +776,7 @@ func ViewIssue(ctx *context.Context) { if issue.IsPull { pull := issue.PullRequest + pull.Issue = issue canDelete := false if ctx.IsSigned { @@ -833,8 +834,9 @@ func ViewIssue(ctx *context.Context) { return } if pull.ProtectedBranch != nil { - ctx.Data["IsBlockedByApprovals"] = !pull.ProtectedBranch.HasEnoughApprovals(pull) - ctx.Data["GrantedApprovals"] = pull.ProtectedBranch.GetGrantedApprovalsCount(pull) + cnt := pull.ProtectedBranch.GetGrantedApprovalsCount(pull) + ctx.Data["IsBlockedByApprovals"] = pull.ProtectedBranch.RequiredApprovals > 0 && cnt < pull.ProtectedBranch.RequiredApprovals + ctx.Data["GrantedApprovals"] = cnt } ctx.Data["IsPullBranchDeletable"] = canDelete && pull.HeadRepo != nil && git.IsBranchExist(pull.HeadRepo.RepoPath(), pull.HeadBranch) |