mirror of
https://github.com/gogs/gogs.git
synced 2025-05-31 11:42:13 +00:00
repo: improve error handling for PR #4803
This commit is contained in:
parent
1f7983059a
commit
63eaac67a6
@ -644,9 +644,15 @@ func viewIssue(c *context.Context, isPullList bool) {
|
|||||||
pull := issue.PullRequest
|
pull := issue.PullRequest
|
||||||
branchProtected := false
|
branchProtected := false
|
||||||
protectBranch, err := models.GetProtectBranchOfRepoByName(pull.BaseRepoID, pull.HeadBranch)
|
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
|
branchProtected = protectBranch.Protected
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["IsPullBranchDeletable"] = pull.BaseRepoID == pull.HeadRepoID &&
|
c.Data["IsPullBranchDeletable"] = pull.BaseRepoID == pull.HeadRepoID &&
|
||||||
c.Repo.IsWriter() && c.Repo.GitRepo.IsBranchExist(pull.HeadBranch) &&
|
c.Repo.IsWriter() && c.Repo.GitRepo.IsBranchExist(pull.HeadBranch) &&
|
||||||
!branchProtected
|
!branchProtected
|
||||||
|
Loading…
x
Reference in New Issue
Block a user