Browse Source

repo: improve error handling for PR #4803

pull/5126/head
Unknwon 7 years ago
parent
commit
63eaac67a6
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 8
      routes/repo/issue.go

8
routes/repo/issue.go

@ -644,9 +644,15 @@ func viewIssue(c *context.Context, isPullList bool) {
pull := issue.PullRequest
branchProtected := false
protectBranch, err := models.GetProtectBranchOfRepoByName(pull.BaseRepoID, pull.HeadBranch)
if err == nil {
if err != nil {
if !errors.IsErrBranchNotExist(err) {
c.ServerError("GetProtectBranchOfRepoByName", err)
return
}
} else {
branchProtected = protectBranch.Protected
}
c.Data["IsPullBranchDeletable"] = pull.BaseRepoID == pull.HeadRepoID &&
c.Repo.IsWriter() && c.Repo.GitRepo.IsBranchExist(pull.HeadBranch) &&
!branchProtected

Loading…
Cancel
Save